- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Math.sign() function in JavaScript
The sign() function of the Math object accepts an integer number and returns its sign.(positive, negative)
- If the given number is a positive integer then, this function returns +1.
- And, if the given number is a negative integer then, this function returns -1.
Syntax
Its Syntax is as follows
Math.sign();
Example
<html> <head> <title>JavaScript Example</title> </head> <body> <script type="text/javascript"> var result = Math.sign(-128); document.write("Result: "+result); </script> </body> </html>
Output
Result: -1
Advertisements