articles » current » javascript » ie11 » ie11-prototype-math-sign

JavaScript: IE11 Math.sign() Method/Function

Create the Math.sign() function for Internet Explorer 11.

Still developing for IE11? Well, the Math.sign() static method returns 1 or -1, indicating the sign of the number passed as argument.

Math.sign = Math.sign || function (x) { return (x * Math.abs(x)) < 0 ? -1 : 1; };

This site uses cookies. Cookies are simple text files stored on the user's computer. They are used for adding features and security to this site. Read the privacy policy.