JavaScript Polyfills

Making sure all your JS works

Thu, 14 Feb 2019

Unsplash

While working through the ES6 course by Wes Bos we went over JavaScript polyfills. These are basically a way to add new functionality that has been added by ES6 and beyond to older browsers. This is accomplished by adding the missing feature to the prototype.

Let’s take Array.From as an example. We can find the polyfill for this here at the Mozilla Developer Network. Now you can simply grab this code and add it to your script. Another more elegant way for you to do this is Polyfill.io which you add as a script tag to your page and it will determine based on the browser what polyfills to add so you don’t need to hunt around for them.

Polyfills are extremely helpful as they allow you to work with new features introduced each year yet still support older browsers. Not everyone has the luxury of having an evergreen browser every time they access the web so we need to be sure to support them.

SHARE
André Wanlin

André Wanlin is a Full Stack Developer and Team Leader at Petline Insurance Company, where André leads application development, including system administration and support. André has worked in .NET since 2008 and is passionate about DevOps and development methodologies like Lean, Agile, Scrum and Kanban. He loves to talk about Azure DevOps (formerly Team Foundation Server). André is a dog owner, an avid concert goer, and traveler from Winnipeg, Manitoba. You can reach him at andre@wanlin.ca or go to andre.wanlin.ca or you can catch him walking his dog at one of the many dog parks in the city.