How to use asin in JavaScript
In this article, I will explain use of asin() method in JavaScript.
JavaScript asin() Method
-
asin() method of math object returns the arcsine in radians of a number.
-
asin() method returns a numeric value between -pi/2 and pi/2 radians for x between -1 and 1.
-
In asin() method, if x value of number is outside this range, it returns NaN.
Syntax
Example
In the following example show to asin() method returns the arcsine of numbers.
<!DOCTYPE html>
<html>
<body>
<h3 style="background-color:Silver">asin() Method Example</h3>
<p id="demo">Click the button to display the arcsine of 0.8</p>
<button onclick="myFunction()">Click On</button>
<script type="text/javascript">
function myFunction() {
document.getElementById("demo").innerHTML = Math.asin(0.8);
}
</script>
</body>
</html>
|
Output1
Output2
You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here