Get the absolute value of a number with JavaScript Get the absolute (positive) value of a number. // returns 42 Math.abs(42); // also returns 42 Math.abs(-42); Source https://vanillajstoolkit.com/reference/numbers/math-abs/