From the course: JavaScript: Async

Unlock the full course today

Join today to access over 24,000 courses taught by industry experts.

Making code backward-compatible with polyfill

Making code backward-compatible with polyfill - JavaScript Tutorial

From the course: JavaScript: Async

Making code backward-compatible with polyfill

- [Instructor] Promises became part of JavaScript in 2015 and are supported by all modern browsers. However, code that uses promises won't work on older browsers or on Opera Mini. And unlike a lot of other modern JavaScript syntax, promises can't be simply transpired by a tool like Babel. Instead, a number of polyfills are available to replicate promise's syntax on browsers that don't support it natively. This polyfill written by Taylor Hakes makes a minified version available via CDN. So I'm going to copy that. And then in my editor, I'm actually going to work with the HTML file. And in this file, I have my JavaScript files in the head section, and I need to make sure to insert the code for the promises polyfill before the code for my Ajax, which uses it. So I'm going to insert that new script element on the line before the script element that references ajax.js. So I'm going to save that and going back to my browser.…

Contents