Math.abs() - Math.abs() - The
Math.abs()
method returns the absolute value of a number. - Метод Math.abs() возвращает абсолютное значение числа.
Näide:
let a = Math.abs(7.25);
let b = Math.abs(-7.25);
let c = Math.abs(null);
let d = Math.abs("Hello");
let e = Math.abs(2-3);
7.25
7.25
0
NaN
1