Learn

In this lesson we learned:

  • Changes to JavaScript features over time can result in your modern website not working for users with older browsers, this issue is called browser compatibility.
  • Modern JavaScript can be transpiled into older syntax, making it run on older browser versions.
  • A popular Node package for transpiling your project automatically is called Babel.
  • Babel is configured to target a list of browsers or a percentage of internet users via a .browserslistrc file.

Babel can be set up by:

  • Initializing your project with npm init
  • Installing the necessary libraries as developer dependencies:
    • @babel/cli
    • @babel/preset-env
  • Adding a build command in package.json specifying your source code directory and the output location.

Using Babel and transpilation, you can make your website more consistent across all of the ways users access the internet!

Instructions

Feel free to change the provided JavaScript code or play around with the list of supported browsers!

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?