JavaScript: Math SQRT1_2 property
This JavaScript tutorial explains how to use the math property called Math.SQRT1_2 with syntax and examples.
Description
In JavaScript, Math.SQRT1_2 is a math property that is used to return the square root of 1/2 which is the mathematical constant 1/√2
. Because Math.SQRT1_2 is a property of the Math object, it must be invoked through the placeholder object called Math.
Syntax
In JavaScript, the syntax for the Math.SQRT1_2 property is:
Math.SQRT1_2;
Parameters or Arguments
There are no parameters or arguments for the Math.SQRT1_2 property.
Returns
The Math.SQRT1_2 property returns the mathematical constant 1/√2
which has an approximate value of 0.7071067811865476. This is the reciprocal of the square root of 2.
Note
- The Math.SQRT1_2 property is a property of the Math object and not a math function. However, we have included the Math.SQRT1_2 property within our JS Math Functions section because you will most likely use this property in conjunction with the Math functions found in this section.
Example
Let's take a look at an example of how to use the Math.SQRT1_2 property in JavaScript.
For example:
console.log(Math.SQRT1_2);
In this example, we have invoked the Math.SQRT1_2 property using the Math class.
We have written the output of the Math.SQRT1_2 property to the web browser console log, for demonstration purposes, to show what the Math.SQRT1_2 property returns.
The following will be output to the web browser console log:
0.7071067811865476
In this example, the Math.SQRT1_2 property returned a value of 0.7071067811865476 which is the value of the mathematical constant 1/√2
.
Advertisements