A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/javascript/Math/abs below:

abs ยท WebPlatform Docs

abs Summary

Returns the absolute value of a number (the value without regard to whether it is positive or negative). For example, the absolute value of -5 is the same as the absolute value of 5.

Syntax
Math.abs( number )
number
Required. The required number argument is a numeric expression for which the absolute value is needed.
Return Value

The absolute value of the number argument.

Examples

The following example illustrates the use of the abs function.

var s;
 var v1 = Math.abs(6);
 var v2 = Math.abs(-6);
 if (v1 == v2) {
     document.write("Absolute values are the same.");
 }
 else {
 document.write("Absolute values are different.");
 }

 
See also Other articles Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4