JavaScript Math sqrt() methodThe JavaScript math sqrt() method returns the square root of a number. If the provided number is negative, it returns NaN. SyntaxThe sqrt() method is represented by the following syntax: Parameternum - A number. ReturnThe square root of the given number. JavaScript Math sqrt() method exampleHere, we will understand sqrt() method through various examples. Example 1Let's see an example to print square root of the given numbers. Test it NowOutput: 4 3.4641016151377544 Example 2Let's see some cases where sqrt() method returns NaN. Test it NowOutput: NaN NaN Example 3Here, you can test sqrt() method with your own test cases. Test it NowNext TopicJavaScript Math |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India