JavaScript Math sign() methodThe JavaScript math sign() method returns the sign of the number. It indicates whether the given number is positive, negative or zero. SyntaxThe sign() method is represented by the following syntax: Parameternum - A number. ReturnThe sign of the given number. JavaScript Math sign() method exampleHere, we will understand sign() method through various examples. Example 1Let's see an example to find out the sign of the given number. Test it NowOutput: 1 -1 0 Example 2Let's see some cases where sign() method returns NaN. Test it NowOutput: NaN NaN NaN Example 3Here, you can test sign() method with your own test cases. Test it Now
Next TopicJavaScript Math
|
Javatpoint provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India