recursal/MDN huggingface dataset:
Math.SQRT2
==========

The **`Math.SQRT2`** static data property represents the square root of 2, approximately 1.414.

Try it
------

Value
-----


𝙼𝚊𝚝𝚑.𝚂𝚀𝚁𝚃𝟸
=

2

≈
1.414

\mathtt{\mi{Math.SQRT2}} = \sqrt{2} \approx 1.414



| Property attributes of `Math.SQRT2` |
| --- |
| Writable | no |
| Enumerable | no |
| Configurable | no |

Description
-----------

`Math.SQRT2` is a constant and a more performant equivalent to `Math.sqrt(2)`.

Because `SQRT2` is a static property of `Math`, you always use it as `Math.SQRT2`, rather than as a property of a `Math` object you created (`Math` is not a constructor).

Examples
--------

### Using Math.SQRT2

The following function returns the square root of 2:


```js
function getRoot2() {
  return Math.SQRT2;
}

getRoot2(); // 1.4142135623730951
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-math.sqrt2 |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `Math.pow()`
* `Math.sqrt()`
Math.LN10
=========

The **`Math.LN10`** static data property represents the natural logarithm of 10, approximately 2.302.

Try it
------

Value
-----


𝙼𝚊𝚝𝚑.𝙻𝙽𝟷𝟶
=
ln
(
10
)
≈
2.302

\mathtt{\mi{Math.LN10}} = \ln(10) \approx 2.302



| Property attributes of `Math.LN10` |
| --- |
| Writable | no |
| Enumerable | no |
| Configurable | no |

Description
-----------

Because `LN10` is a static property of `Math`, you always use it as `Math.LN10`, rather than as a property of a `Math` object you created (`Math` is not a constructor).

Examples
--------

### Using Math.LN10

The following function returns the natural log of 10:


```js
function getNatLog10() {
  return Math.LN10;
}

getNatLog10(); // 2.302585092994046
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-math.ln10 |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `Math.exp()`
* `Math.log()`
* `Math.log10()`
Math.hypot()
============

The **`Math.hypot()`** static method returns the square root of the sum of squares of its arguments. That is,


𝙼𝚊𝚝𝚑.𝚑𝚢𝚙𝚘𝚝
(

v
1

,

v
2

,
…
,

v
n

)

=

∑

i
=
1

n

v
i
2

=

v
1
2

+

v
2
2

+
…
+

v
n
2

\mathtt{\operatorname{Math.hypot}(v\_1, v\_2, \dots, v\_n)} = \sqrt{\sum\_{i=1}^n v\_i^2} = \sqrt{v\_1^2 + v\_2^2 + \dots + v\_n^2}

Try it
------

Syntax
------


```js
Math.hypot()
Math.hypot(value1)
Math.hypot(value1, value2)
Math.hypot(value1, value2, /\* …, \*/ valueN)
```

### Parameters

`value1`, …, `valueN`

Numbers.

### Return value

The square root of the sum of squares of the given arguments. Returns `Infinity` if any of the arguments is ±Infinity. Otherwise, if at least one of the arguments is or is converted to `NaN`, returns `NaN`. Returns `0` if no arguments are given or all arguments are ±0.

Description
-----------

Calculating the hypotenuse of a right triangle, or the magnitude of a complex number, uses the formula `Math.sqrt(v1*v1 + v2*v2)`, where v1 and v2 are the lengths of the triangle's legs, or the complex number's real and complex components. The corresponding distance in 2 or more dimensions can be calculated by adding more squares under the square root: `Math.sqrt(v1*v1 + v2*v2 + v3*v3 + v4*v4)`.

This function makes this calculation easier and faster; you call `Math.hypot(v1, v2)`, or `Math.hypot(v1, /* …, */, vN)`.

`Math.hypot` also avoids overflow/underflow problems if the magnitude of your numbers is very large. The largest number you can represent in JS is `Number.MAX_VALUE`, which is around 10308. If your numbers are larger than about 10154, taking the square of them will result in Infinity. For example, `Math.sqrt(1e200*1e200 + 1e200*1e200) = Infinity`. If you use `hypot()` instead, you get a better answer: `Math.hypot(1e200, 1e200) = 1.4142...e+200` . This is also true with very small numbers. `Math.sqrt(1e-200*1e-200 + 1e-200*1e-200) = 0`, but `Math.hypot(1e-200, 1e-200) = 1.4142...e-200`.

With one argument, `Math.hypot()` is equivalent to `Math.abs()`. `Math.hypot.length` is 2, which weakly signals that it's designed to handle at least two parameters.

Because `hypot()` is a static method of `Math`, you always use it as `Math.hypot()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).

Examples
--------

### Using Math.hypot()


```js
Math.hypot(3, 4); // 5
Math.hypot(3, 4, 5); // 7.0710678118654755
Math.hypot(); // 0
Math.hypot(NaN); // NaN
Math.hypot(NaN, Infinity); // Infinity
Math.hypot(3, 4, "foo"); // NaN, since +'foo' => NaN
Math.hypot(3, 4, "5"); // 7.0710678118654755, +'5' => 5
Math.hypot(-3); // 3, the same as Math.abs(-3)
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-math.hypot |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `Math.hypot` in `core-js`
* `Math.abs()`
* `Math.pow()`
* `Math.sqrt()`
Math.tanh()
===========

The **`Math.tanh()`** static method returns the hyperbolic tangent of a number. That is,


𝙼𝚊𝚝𝚑.𝚝𝚊𝚗𝚑
(
𝚡
)

=
tanh
(
x
)
=

sinh
(
x
)

cosh
(
x
)

=

e
x

−

e

−
x


e
x

+

e

−
x

=

e

2
x

−
1

e

2
x

+
1

\mathtt{\operatorname{Math.tanh}(x)} = \tanh(x) = \frac{\sinh(x)}{\cosh(x)} = \frac{\mathrm{e}^x - \mathrm{e}^{-x}}{\mathrm{e}^x + \mathrm{e}^{-x}} = \frac{\mathrm{e}^{2x} - 1}{\mathrm{e}^{2x}+1}

Try it
------

Syntax
------


```js
Math.tanh(x)
```

### Parameters

`x`

A number.

### Return value

The hyperbolic tangent of `x`.

Description
-----------

Because `tanh()` is a static method of `Math`, you always use it as `Math.tanh()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).

Examples
--------

### Using Math.tanh()


```js
Math.tanh(-Infinity); // -1
Math.tanh(-0); // -0
Math.tanh(0); // 0
Math.tanh(1); // 0.7615941559557649
Math.tanh(Infinity); // 1
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-math.tanh |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `Math.tanh` in `core-js`
* `Math.acosh()`
* `Math.asinh()`
* `Math.atanh()`
* `Math.cosh()`
* `Math.sinh()`
Math.ceil()
===========

The **`Math.ceil()`** static method always rounds up and returns the smallest integer greater than or equal to a given number.

Try it
------

Syntax
------


```js
Math.ceil(x)
```

### Parameters

`x`

A number.

### Return value

The smallest integer greater than or equal to `x`. It's the same value as `-Math.floor(-x)`.

Description
-----------

Because `ceil()` is a static method of `Math`, you always use it as `Math.ceil()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).

Examples
--------

### Using Math.ceil()


```js
Math.ceil(-Infinity); // -Infinity
Math.ceil(-7.004); // -7
Math.ceil(-4); // -4
Math.ceil(-0.95); // -0
Math.ceil(-0); // -0
Math.ceil(0); // 0
Math.ceil(0.95); // 1
Math.ceil(4); // 4
Math.ceil(7.004); // 8
Math.ceil(Infinity); // Infinity
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-math.ceil |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `Math.abs()`
* `Math.floor()`
* `Math.round()`
* `Math.sign()`
* `Math.trunc()`
Math.trunc()
============

The **`Math.trunc()`** static method returns the integer part of a number by removing any fractional digits.

Try it
------

Syntax
------


```js
Math.trunc(x)
```

### Parameters

`x`

A number.

### Return value

The integer part of `x`.

Description
-----------

Unlike the other three `Math` methods: `Math.floor()`, `Math.ceil()` and `Math.round()`, the way `Math.trunc()` works is very simple. It *truncates* (cuts off) the dot and the digits to the right of it, no matter whether the argument is a positive or negative number.

Because `trunc()` is a static method of `Math`, you always use it as `Math.trunc()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).

Examples
--------

### Using Math.trunc()


```js
Math.trunc(-Infinity); // -Infinity
Math.trunc("-1.123"); // -1
Math.trunc(-0.123); // -0
Math.trunc(-0); // -0
Math.trunc(0); // 0
Math.trunc(0.123); // 0
Math.trunc(13.37); // 13
Math.trunc(42.84); // 42
Math.trunc(Infinity); // Infinity
```

### Using bitwise no-ops to truncate numbers

**Warning:** This is not a polyfill for `Math.trunc()` because of non-negligible edge cases.

Bitwise operations convert their operands to 32-bit integers, which people have historically taken advantage of to truncate float-point numbers. Common techniques include:


```js
const original = 3.14;
const truncated1 = ~~original; // Double negation
const truncated2 = original & -1; // Bitwise AND with -1
const truncated3 = original | 0; // Bitwise OR with 0
const truncated4 = original ^ 0; // Bitwise XOR with 0
const truncated5 = original >> 0; // Bitwise shifting by 0
```


Beware that this is essentially `toInt32`, which is not the same as `Math.trunc`. When the value does not satisfy -231 - 1 < `value` < 231 (-2147483649 < `value` < 2147483648), the conversion would overflow.


```js
const a = ~~2147483648; // -2147483648
const b = ~~-2147483649; // 2147483647
const c = ~~4294967296; // 0
```


Only use `~~` as a substitution for `Math.trunc()` when you are confident that the range of input falls within the range of 32-bit integers.

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-math.trunc |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `Math.trunc` in `core-js`
* `Math.abs()`
* `Math.ceil()`
* `Math.floor()`
* `Math.round()`
* `Math.sign()`
Math.exp()
==========

The **`Math.exp()`** static method returns e raised to the power of a number. That is


𝙼𝚊𝚝𝚑.𝚎𝚡𝚙
(
𝚡
)

=

e
x

\mathtt{\operatorname{Math.exp}(x)} = \mathrm{e}^x

Try it
------

Syntax
------


```js
Math.exp(x)
```

### Parameters

`x`

A number.

### Return value

A nonnegative number representing ex, where e is the base of the natural logarithm.

Description
-----------

Because `exp()` is a static method of `Math`, you always use it as `Math.exp()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).

Beware that `e` to the power of a number very close to 0 will be very close to 1 and suffer from loss of precision. In this case, you may want to use `Math.expm1` instead, and obtain a much higher-precision fractional part of the answer.

Examples
--------

### Using Math.exp()


```js
Math.exp(-Infinity); // 0
Math.exp(-1); // 0.36787944117144233
Math.exp(0); // 1
Math.exp(1); // 2.718281828459045
Math.exp(Infinity); // Infinity
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-math.exp |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `Math.E`
* `Math.expm1()`
* `Math.log()`
* `Math.log10()`
* `Math.log1p()`
* `Math.log2()`
* `Math.pow()`
Math.PI
=======

The **`Math.PI`** static data property represents the ratio of the circumference of a circle to its diameter, approximately 3.14159.

Try it
------

Value
-----


𝙼𝚊𝚝𝚑.𝙿𝙸
=
π
≈
3.14159

\mathtt{\mi{Math.PI}} = \pi \approx 3.14159



| Property attributes of `Math.PI` |
| --- |
| Writable | no |
| Enumerable | no |
| Configurable | no |

Description
-----------

Because `PI` is a static property of `Math`, you always use it as `Math.PI`, rather than as a property of a `Math` object you created (`Math` is not a constructor).

Examples
--------

### Using Math.PI

The following function uses `Math.PI` to calculate the circumference of a circle with a passed radius.


```js
function calculateCircumference(radius) {
  return Math.PI \* (radius + radius);
}

calculateCircumference(1); // 6.283185307179586
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-math.pi |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `Math`
Math.sinh()
===========

The **`Math.sinh()`** static method returns the hyperbolic sine of a number. That is,


𝙼𝚊𝚝𝚑.𝚜𝚒𝚗𝚑
(
𝚡
)

=
sinh
(
x
)
=

e
x

−

e

−
x

2

\mathtt{\operatorname{Math.sinh}(x)} = \sinh(x) = \frac{\mathrm{e}^x - \mathrm{e}^{-x}}{2}

Try it
------

Syntax
------


```js
Math.sinh(x)
```

### Parameters

`x`

A number.

### Return value

The hyperbolic sine of `x`.

Description
-----------

Because `sinh()` is a static method of `Math`, you always use it as `Math.sinh()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).

Examples
--------

### Using Math.sinh()


```js
Math.sinh(-Infinity); // -Infinity
Math.sinh(-0); // -0
Math.sinh(0); // 0
Math.sinh(1); // 1.1752011936438014
Math.sinh(Infinity); // Infinity
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-math.sinh |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `Math.sinh` in `core-js`
* `Math.acosh()`
* `Math.asinh()`
* `Math.atanh()`
* `Math.cosh()`
* `Math.tanh()`
Math.log2()
===========

The **`Math.log2()`** static method returns the base 2 logarithm of a number. That is



∀
x
>
0
,

𝙼𝚊𝚝𝚑.𝚕𝚘𝚐𝟸
(
𝚡
)

=

log
2

(
x
)
=
the unique 
y
 such that 

2
y

=
x

\forall x > 0,;\mathtt{\operatorname{Math.log2}(x)} = \log\_2(x) = \text{the unique } y \text{ such that } 2^y = x

Try it
------

Syntax
------


```js
Math.log2(x)
```

### Parameters

`x`

A number greater than or equal to 0.

### Return value

The base 2 logarithm of `x`. If `x < 0`, returns `NaN`.

Description
-----------

Because `log2()` is a static method of `Math`, you always use it as `Math.log2()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).

This function is the equivalent of `Math.log(x) / Math.log(2)`. For `log2(e)`, use the constant `Math.LOG2E`, which is 1 / `Math.LN2`.

Examples
--------

### Using Math.log2()


```js
Math.log2(-2); // NaN
Math.log2(-0); // -Infinity
Math.log2(0); // -Infinity
Math.log2(1); // 0
Math.log2(2); // 1
Math.log2(3); // 1.584962500721156
Math.log2(1024); // 10
Math.log2(Infinity); // Infinity
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-math.log2 |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `Math.log2` in `core-js`
* `Math.exp()`
* `Math.log()`
* `Math.log10()`
* `Math.log1p()`
* `Math.pow()`
Math.tan()
==========

The **`Math.tan()`** static method returns the tangent of a number in radians.

Try it
------

Syntax
------


```js
Math.tan(x)
```

### Parameters

`x`

A number representing an angle in radians.

### Return value

The tangent of `x`. If `x` is `Infinity`, `-Infinity`, or `NaN`, returns `NaN`.

**Note:** Due to floating point precision, it's not possible to obtain the exact value π/2, so the result is always finite if not `NaN`.

Description
-----------

Because `tan()` is a static method of `Math`, you always use it as `Math.tan()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).

Examples
--------

### Using Math.tan()


```js
Math.tan(-Infinity); // NaN
Math.tan(-0); // -0
Math.tan(0); // 0
Math.tan(1); // 1.5574077246549023
Math.tan(Math.PI / 4); // 0.9999999999999999 (Floating point error)
Math.tan(Infinity); // NaN
```

### Math.tan() and π/2

It's not possible to calculate `tan(π/2)` exactly.


```js
Math.tan(Math.PI / 2); // 16331239353195370
Math.tan(Math.PI / 2 + Number.EPSILON); // -6218431163823738
```

### Using Math.tan() with a degree value

Because the `Math.tan()` function accepts radians, but it is often easier to work with degrees, the following function accepts a value in degrees, converts it to radians and returns the tangent.


```js
function getTanDeg(deg) {
  const rad = (deg \* Math.PI) / 180;
  return Math.tan(rad);
}
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-math.tan |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `Math.acos()`
* `Math.asin()`
* `Math.atan()`
* `Math.atan2()`
* `Math.cos()`
* `Math.sin()`
Math.fround()
=============

The **`Math.fround()`** static method returns the nearest 32-bit single precision float representation of a number.

Try it
------

Syntax
------


```js
Math.fround(doubleFloat)
```

### Parameters

`doubleFloat`

A number.

### Return value

The nearest 32-bit single precision float representation of `x`.

Description
-----------

JavaScript uses 64-bit double floating-point numbers internally, which offer a very high precision. However, sometimes you may be working with 32-bit floating-point numbers, for example if you are reading values from a `Float32Array`. This can create confusion: checking a 64-bit float and a 32-bit float for equality may fail even though the numbers are seemingly identical.

To solve this, `Math.fround()` can be used to cast the 64-bit float to a 32-bit float. Internally, JavaScript continues to treat the number as a 64-bit float, it just performs a "round to even" on the 23rd bit of the mantissa, and sets all following mantissa bits to `0`. If the number is outside the range of a 32-bit float, `Infinity` or `-Infinity` is returned.

Because `fround()` is a static method of `Math`, you always use it as `Math.fround()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).

Examples
--------

### Using Math.fround()

The number 1.5 can be precisely represented in the binary numeral system, and is identical in 32-bit and 64-bit:


```js
Math.fround(1.5); // 1.5
Math.fround(1.5) === 1.5; // true
```


However, the number 1.337 cannot be precisely represented in the binary numeral system, so it differs in 32-bit and 64-bit:


```js
Math.fround(1.337); // 1.3370000123977661
Math.fround(1.337) === 1.337; // false
```



2
150

2^150

 is too big for a 32-bit float, so `Infinity` is returned:


```js
2 \*\* 150; // 1.42724769270596e+45
Math.fround(2 \*\* 150); // Infinity
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-math.fround |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `Math.fround` in `core-js`
* `Math.round()`
Math.imul()
===========

The **`Math.imul()`** static method returns the result of the C-like 32-bit multiplication of the two parameters.

Try it
------

Syntax
------


```js
Math.imul(a, b)
```

### Parameters

`a`

First number.

`b`

Second number.

### Return value

The result of the C-like 32-bit multiplication of the given arguments.

Description
-----------

`Math.imul()` allows for 32-bit integer multiplication with C-like semantics. This feature is useful for projects like Emscripten.

Because `imul()` is a static method of `Math`, you always use it as `Math.imul()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).

If you use normal JavaScript floating point numbers in `imul()`, you will experience a degrade in performance. This is because of the costly conversion from a floating point to an integer for multiplication, and then converting the multiplied integer back into a floating point. However, with asm.js, which allows JIT-optimizers to more confidently use integers in JavaScript, multiplying two numbers stored internally as integers (which is only possible with asm.js) with `imul()` could be potentially more performant.

Examples
--------

### Using Math.imul()


```js
Math.imul(2, 4); // 8
Math.imul(-1, 8); // -8
Math.imul(-2, -2); // 4
Math.imul(0xffffffff, 5); // -5
Math.imul(0xfffffffe, 5); // -10
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-math.imul |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Polyfill of `Math.imul` in `core-js`
* Emscripten on Wikipedia
Math.E
======

The **`Math.E`** static data property represents Euler's number, the base of natural logarithms, e, which is approximately 2.718.

Try it
------

Value
-----


𝙼𝚊𝚝𝚑.𝙴
=
e
≈
2.718

\mathtt{\mi{Math.E}} = e \approx 2.718



| Property attributes of `Math.E` |
| --- |
| Writable | no |
| Enumerable | no |
| Configurable | no |

Description
-----------

Because `E` is a static property of `Math`, you always use it as `Math.E`, rather than as a property of a `Math` object you created (`Math` is not a constructor).

Examples
--------

### Using Math.E

The following function returns e:


```js
function getNapier() {
  return Math.E;
}

getNapier(); // 2.718281828459045
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-math.e |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `Math.exp()`
* `Math.log()`
* `Math.log1p()`
Math.asin()
===========

The **`Math.asin()`** static method returns the inverse sine (in radians) of a number. That is,



∀
x
∊
[

−
1

,
1
]
,

𝙼𝚊𝚝𝚑.𝚊𝚜𝚒𝚗
(
𝚡
)

=
arcsin
(
x
)
=
the unique 
y
∊

[

−

π
2

,

π
2

]

 such that 
sin
(
y
)
=
x

\forall x \in [{-1}, 1],;\mathtt{\operatorname{Math.asin}(x)} = \arcsin(x) = \text{the unique } y \in \left[-\frac{\pi}{2}, \frac{\pi}{2}\right] \text{ such that } \sin(y) = x

Try it
------

Syntax
------


```js
Math.asin(x)
```

### Parameters

`x`

A number between -1 and 1, inclusive, representing the angle's sine value.

### Return value

The inverse sine (angle in radians between 


-

π
2

-\frac{\pi}{2}

 and 


π
2

\frac{\pi}{2}

, inclusive) of `x`. If `x` is less than -1 or greater than 1, returns `NaN`.

Description
-----------

Because `asin()` is a static method of `Math`, you always use it as `Math.asin()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).

Examples
--------

### Using Math.asin()


```js
Math.asin(-2); // NaN
Math.asin(-1); // -1.5707963267948966 (-π/2)
Math.asin(-0); // -0
Math.asin(0); // 0
Math.asin(0.5); // 0.5235987755982989 (π/6)
Math.asin(1); // 1.5707963267948966 (π/2)
Math.asin(2); // NaN
```

Specifications
--------------

| Specification |
| --- |
| ECMAScript Language Specification # sec-math.asin |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `Math.acos()`
* `Math.atan()`
* `Math.atan2()`
* `Math.cos()`
* `Math.sin()`
* `Math.tan()`