This JavaScript tutorial explains how to use the math feature referred to as asin() with syntax and examples.
Description
In JavaScript, asin() is a function that is used to return the arc sine of a number, with the end result expressed in radians. Because the asin() feature is a static feature of the Math object, it must be invoked via the placeholder object known as Math.
Syntax
In JavaScript, the syntax for the asin() feature is:
Math.asin(number);
Parameters or Arguments
number The number used to calculate the arc sine in radians. The variety need to be a cost between 1 and -1.
Returns
The asin() feature returns the arc sine of a quantity and the result is expressed in radians.
If the range is now not within the range of -1 and 1, the asin() function will return NaN.
Note
Math is a placeholder object that contains mathematical functions and constants of which asin() is one of these functions.
Example
Let’s take a seem to be at an instance of how to use the asin() characteristic in JavaScript.
For example:
console.log(Math.asin(0.75));
console.log(Math.asin(-0.9));
console.log(Math.asin(2));
In this example, we have invoked the asin() characteristic the use of the Math class.
We have written the output of the asin() feature to the web browser console log, for demonstration purposes, to show what the asin() characteristic returns.
The following will be output to the internet browser console log:
0.848062078981481
-1.1197695149986342
NaN
In this example, the first output to the console log again 0.848062078981481 which is the arc sine of 0.75. The second output to the console log lower back -1.1197695149986342 which is the arc sine of -0.9. The 0.33 output to the console log back NaN considering the quantity was no longer within the vary of 1 and -1.
The result from the asin() function is expressed in radians.
Leave a Review