Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. JavaScript Course

Lesson 34 of 55 · javascript

Transpiling with Babel – ES6 → ES5

Duration: 10 mins

Babel converts modern JavaScript into a version compatible with older browsers.

npm install --save-dev @babel/core @babel/cli @babel/preset-env

.babelrc

{
  "presets": ["@babel/preset-env"]
}

Run:

npx babel src --out-dir lib

Example: Optional chaining (needs Babel)

const name = user?.profile?.name ?? 'Guest';

Babel will transform it to safe property checks for browsers that don’t support the syntax.

Previous: Web Components – Custom Elements, Shadow DOM & TemplatesNext: Memory Management – Garbage Collection & Leaks