The mathMax() function returns the largest of the zero or more numbers given as input parameters, or NaN if any parameter isn't a number and can't be converted into one.

If no arguments are given, the result is -Infinity.

If at least one of arguments cannot be converted to a number, the result is NaN.

0.4.2

mathMax(10, 20);   //  20
mathMax(-10, -20); // -10
mathMax(-10, 20); // 20
  • Parameters

    • Rest...values: number[]

      Zero or more numbers among which the largest value will be selected and returned.

    Returns number

    The largest of the given numbers. If any one or more of the parameters cannot be converted into a number, NaN is returned. The result is -Infinity if no parameters are provided.