×

### Html & Html5

Introduction to Html

Html5 Grid

Html5 Graphics

Html5 Media

### Js Math

It is the type of an object which provides many constants and methods to perform the mathematical operations. Math objects do not use constructor.

Let's talk about some methods of Math object

Math.sqrt(n)

This method can find the square root of the given number

Let's take an example:-

<html>

<body>

<p id="demo"> </p>

<script>

document.getElementById('demo').innerHTML= Math.sqrt(25); </script>

</body>

</html>

### Output of this program

5

Math.pow(m,n)

This method is used to get the power values .

Let's take an example:-

<html>

<body>

<p id="demo"> </p>

<script>

document.getElementById('demo').innerHTML= Math.pow(3,4); </script>

</body>

</html>

### Output of this program

81

Math.random()

This method is used to get the random number 0 to 1.

Let's take an example:-

<html>

<body>

<p id="demo"> </p>

<script>

document.getElementById('demo').innerHTML= Math.random();

</script>

</body>

</html>

Some more methods and description below :-

Methods Description
abs() It returns the absolute value of the given number.
acos() It returns the arccosine of the given number in radians.
ceil() It returns a smallest integer value, greater than or equal to the given number.
cos() It returns the cosine of the given number.
floor() It returns largest integer value, lower than or equal to the given number.
max() It returns maximum value of the given numbers.
min() It returns minimum value of the given numbers.
random() It returns random number between 0 (inclusive) and 1 (exclusive).
round() It returns closest integer value of the given number.
sqrt() It returns the square root of the given number

JS training insitute | Best IT Training classes in Gurgaon | Web Designing Training Institute