Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript sign

Math.sign(number)

Parameters: This function accepts a single parameter number which represents the number whose sign you want to know.

Return Value: The Math.sign() function returns five different values as described below:

1. It returns 1 if the argument passed is a positive number.
2. It returns -1 if the argument passed is a negative number.
3. It returns 0 if the argument passed is a positive zero.
4. It returns -0 if the argument passed is a negative zero.
5. If none of the above cases match,it returns Nan.
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #javascript #sign
ADD COMMENT
Topic
Name
6+9 =