Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

Math.abs()

Get the absolute value of a number.

Signature

Math.abs(val: Number) => Number

Description

The Math.abs() method returns the absolute value of val, which is a Number.

Parameters

Parameter Type Required Description

val

Number

Yes

Number for which you want the absolute value.

Return value

Type Description

Number

Absolute value of val.

Examples

  1. Get the absolute value of an integer:

    Math.abs(5)
    5
  2. Get the absolute value of a negative integer:

    Math.abs(-5)
    5
  3. Get the absolution value of a real number:

    Math.abs(-5.1)
    5.1

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!