Categories > Coding > Javascript >

How does Babel work?

Moon

Moon

vip

Posts: 7441

Threads: 314

Joined: Aug, 2020

Reputation: 80

Posted

Is there a converter? Or do you just put it in the <script> tag In HTML?

  • 0

Wabz

Winning.js

Posts: 2410

Threads: 194

Joined: Apr, 2020

Reputation: 27

Replied

Babel transpiles (converts) the code into JS code but if I was you I wouldn't use babel unless I was experienced with JS already.

  • 0

My new discord is Wabz#1337 with ID 777154062789509130

Moon

Moon

vip

Posts: 7441

Threads: 314

Joined: Aug, 2020

Reputation: 80

Replied

@Wabz

Well I was wondering if you could use already written babel code and convert it into normal js

  • 0

Wabz

Winning.js

Posts: 2410

Threads: 194

Joined: Apr, 2020

Reputation: 27

Replied

@Moon yes you can

  • 0

My new discord is Wabz#1337 with ID 777154062789509130

Moon

Moon

vip

Posts: 7441

Threads: 314

Joined: Aug, 2020

Reputation: 80

Replied

@Wabz

Using what?

  • 0

Wabz

Winning.js

Posts: 2410

Threads: 194

Joined: Apr, 2020

Reputation: 27

Replied

@Moon Using babel itself -_-

  • 0

My new discord is Wabz#1337 with ID 777154062789509130

Moon

Moon

vip

Posts: 7441

Threads: 314

Joined: Aug, 2020

Reputation: 80

Replied

@Wabz

Uh okay

  • 0

AIpha

alpha

Posts: 173

Threads: 23

Joined: May, 2018

Reputation: 4

Replied

@Moon

There's no need. All babel does is transpile newer versions of JS for example ES6 to code which an older version of JS can run without issues for example ES5. Meaning the result of that code is still javascript therefore there is no need to revert it back to its old state unless you really wanted the use of newer properties. All in all babel does the following

--ES6 Input
const array = [69,420]
array.forEach(number => console.log(number ** 2))

--Babel does its transpiling magic 

--ES5 Compatible output
const array = [69,420]
array.forEach(function(x){
  console.log(x ** 2)
})
  • 0

Was on WRD front page

Programs I own - Synapse X, Protosmasher, Sirhurt, Sweat Heart of Sigma Chi, Scriptware V2

Languages I know - C#,JS,Lua,VB.net
Learning - Python, C

Moon

Moon

vip

Posts: 7441

Threads: 314

Joined: Aug, 2020

Reputation: 80

Replied

@AIpha

Thanks

  • 0

AIpha

alpha

Posts: 173

Threads: 23

Joined: May, 2018

Reputation: 4

Replied

@Moon

np my good sir

  • 0

Was on WRD front page

Programs I own - Synapse X, Protosmasher, Sirhurt, Sweat Heart of Sigma Chi, Scriptware V2

Languages I know - C#,JS,Lua,VB.net
Learning - Python, C

TaxiDriver08

JustMarie

Posts: 1547

Threads: 39

Joined: Dec, 2020

Reputation: 6

Replied

Im experienced with js and i never heard of babel xD

 

i guess i like node.js better than native js

  • 0

JustMarie#0709

 

Moon

Moon

vip

Posts: 7441

Threads: 314

Joined: Aug, 2020

Reputation: 80

Replied

@D_tigo

Fat arrows


Seems legit

  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )