There’s no way to polyfill new syntax that has been added to the language. So the better option is to use a tool that converts your newer code into older code equivalents. This process is commonly called transpiling, a term for transforming + compiling.
Typically you insert the transpiler into your build process, similar to your code linter or your minifier. There are quite a few great transpilers for you to choose from:
- Babel: Transpiles ES6+ into ES5
- Traceur: Transpiles ES6, ES7, and beyond into ES5