getify / You-Dont-Know-JS

A book series on JavaScript. @YDKJS on twitter.
Other
178.87k stars 33.44k forks source link

Babel is making the code "backwards-compatible", right? #1613

Closed spidgorny closed 4 years ago

spidgorny commented 4 years ago

It seems the terms got mixed. Please check.

Yes, I promise I've read the Contributions Guidelines (please feel free to remove this line).

Specifically quoting these guidelines regarding typos:

Typos?

Please don't worry about minor text typos. These will almost certainly be caught during the editing process.

If you're going to submit a PR for typo fixes, please be measured in doing so by collecting several small changes into a single PR (in separate commits). Or, just don't even worry about them for now, because we'll get to them later. I promise.


Please type "I already searched for this issue":

Edition: (pull requests not accepted for previous editions)

Book Title:

Chapter:

Section Title:

Topic:

getify commented 4 years ago

The text is correct as stated. Quoting from just a little bit above that:

Being forwards-compatible means that including a new addition to the language in a program would not cause that program to break if it were run in an older JS engine.

So, Babel is helping fix that JS is not, by itself forwards-compatible, in that new additions to the language would break an older JS engine. But thankfully, Babel "fixes" that.

JS is, by its nature, backwards-compatible, in that older code still runs in newer engines already (with a few extremely minor and rare exceptions). We don't need any extra tooling for backwards-compat, it's already baked in to how JS is managed and evolved (the "One JS" principle).