Using JavaScript for math

Math.max(x, y) method

  • used to find highest value of x and y
Math.max(5, 10);
10

Math.min (x, y) method

  • used to find highest value of x and y
Math.min(5, 10);
5

Math.round(x) method

  • used to round x to the closest integer
Math.round(5.7)
6

Math.pow(x, y) method

  • used to take x to the power of y
Math.pow(5, 3)
125

Math.sqrt(x) method

  • used to take the square root of x
Math.sqrt(16)
4

Math.abs(x) method

  • used to take the absolute value of x
Math.abs(-9)
9