@nevware21/ts-utils
    Preparing search index...

    Function mathAbs

    The mathAbs() function returns the absolute value of a number. If the value is negative, it returns the positive value. If the value is already positive, it returns the value unchanged.

    0.12.0

    A number

    The absolute value of x. If x is negative, it returns -x. If x is 0, it returns 0.

    mathAbs(-5); // 5
    mathAbs(5); // 5
    mathAbs(-3.14); // 3.14
    mathAbs(0); // 0
    • 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.

      Parameters

      • x: number

        A numeric expression for which the absolute value is needed.

      Returns number