Overview

Polyfills allow developers to use the latest web standards while still supporting users on older browsers. They 'fill in' the gaps in the browser's API by providing a custom implementation of a missing feature.

How it Works

A polyfill typically checks if a feature exists (e.g., if (!window.Promise)) and, if not, provides its own version of that feature.

Examples

  • Polyfilling Promise for Internet Explorer.
  • Polyfilling fetch for older versions of Safari.
  • Polyfilling Array.prototype.includes.

Related Terms