DEV Community 👩‍💻👨‍💻

Cover image for Babel Basic - Javascript
Ganesh Raja
Ganesh Raja

Posted on • Updated on

Babel Basic - Javascript

I wasn't able to share yesterday's post due to some work. But yesterday I mainly worked on Babel Basics.

So basically bable is a transpiler used to convert ES6+, javascript version into ES5. we have presets to convert typescript,react into Es5 code as well.Explored about how to use babel plugins and the difference between preset and a plugin and other stuffs. It was very interesting thing to learn.

You can find the series repo here

written code

multiplyBy2 = (arr) => => item * 2);

let arr = [1, 2, 3];


let element = 22;
console.log(element ?? -1);

Enter fullscreen mode Exit fullscreen mode

After transpiling to Es5

"use strict";

multiplyBy2 = function multiplyBy2(arr) {
  return (item) {
    return item * 2;

var arr = [1, 2, 3];
var element = 22;
console.log(element !== null && element !== void 0 ? element : -1);

Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Let's Get Wacky

Use any Linode offering to create something unique or silly in the DEV x Linode Hackathon 2022 and win the Wacky Wildcard category

Join the Hackathon <-