Mid JavaScript

How can you polyfill a feature in JavaScript?

A polyfill is a piece of code that adds a feature missing in older browsers.

Follow me on LinkedIn:

Example:

if (!Array.prototype.includes) {

Array.prototype.includes = function(item) {

return this.indexOf(item) !== -1;

More from JavaScript Tutorial

All questions for this course