CodesJava

Easy learning with example program codes

JavaScript math sign() method

The JavaScript math sign() method is used to get the sign of a number.
Syntax:

Math.sign(n)

Parameters
n: It represents the number whose sign have to be get.

Returns
Sign of a number.

Example

<!DOCTYPE html>
<html>
<body>
<script>  
document.writeln(Math.sign(-6));  
</script>  
</body>
</html>

Output

-1
Please follow and like us:
error








Copyright © 2019 CodesJava DMCA.com Protection Status