PROWAREtech
JavaScript: IE11 Math.trunc() Method/Function
Create the Math.trunc() function for Internet Explorer 11.
Still developing for IE11? Well, this prototype is used to truncate any number to an integer.
Math.trunc = Math.trunc || function (num) {
return num < 0 ? Math.ceil(num) : Math.floor(num);
};
Using the above code snippet:
Math.trunc = Math.trunc || function (num) {
return num < 0 ? Math.ceil(num) : Math.floor(num);
};
alert("2314.8=" + Math.trunc(2314.8));
Comment