A new feature that is not backwards supported in certain browser or compiler, Polyfills come into place to solve this problem!
For example :
if(!Math.trunc){ // if no such function
// implement it
Math.trunc = function (number) {
// Math.ceil and Math.floor exist even in ancient JavaScript engines
// they are covered later in the tutorial
return number < 0 ? Math.ceil(number) : Math.floor(number);
}
}
JavaScript
