JavaScript is an ever-evolving language. New features are added to JavaScript every year. When it comes to our browsers it's not necessary that they'll always support the latest features. So how to make our modern code work on older engines that don't understand recent features yet?

There are two tools for that: 1. Transpilers. 2. Polyfills.

1. Transpilers

A transpiler is a special piece of software that translates source code to another source code. It can parse ("read and understand") modern code and rewrite it using older syntax constructs so that it'll also work in outdated engines. Babel is a transpiler and let's see an example of how it works.

Arrow functions are not supported by IE11 and Opera Mini.

None

Babel is a compiler: it takes code written in one standard and transpiles it to code written into another standard. Here Babel will convert it into something like this.

None

2. Polyfills

Polyfills are the functions or features that older browsers don't support and if we don't write some replacement functions for that the code will throw a run time error. So to tackle this problem we write some replacement code so that everything works fine. In modern-day interviews, most companies are asking us to write polyfills for common JavaScript functionalities.

Here I will list down the most important ones. The ones that are asked more frequently.

Polyfill for Array.flat()

Polyfill for Array.filter()

Polyfill for Array.reduce()

Polyfill for Array.map()

Polyfill for Array.forEach()

Polyfill for Promise.all()

Polyfill for Function.bind()

So, these are the important polyfills that come across my mind when I think about the most important polyfills that are asked in interviews.

If you understood anything I said here please give a clap reaction and follow me because it helps me to stay motivated and take out time from my schedule to write these articles. It will not cost you anything but will help me a lot

Gaurav Sharma is an avid reader and a passionate traveler. He is trying to live a more meaningful and purposeful life by spreading his knowledge and his life experiences! Follow him on this new journey of balancing digital and physical life. He is living in Uttarakhand, India. He is on Instagram at @golf._.sierra.

More content at PlainEnglish.io. Sign up for our free weekly newsletter. Follow us on Twitter, LinkedIn, YouTube, and Discord. Interested in Growth Hacking? Check out Circuit.