Javascript & ECMA6 : Exact Differences?

Javascript & ECMA6 : Exact Differences?
0

#1

Hello
I have heard quite a lot about the recent edition of javascript ECMA6 (although another version is in the make). However despite reading up online about this onnline http://kangax.github.io/compat-table/es6/, i am somewhat confused as to the exact differences between javascript (presumably pre-version 6) and ECMA6. I have also heard of languages like Typescript written in a python-like syntax based upon javascript.

Essentially given the number of javascript-based languages floating around (not to mention frameworks), i am a little confused about the exact differences. I know ECMA6 offers more in the form of OOP support but not much else.

Is anyone able to provide a brief overview on the differences for the unenlightened here? It would be much appreciated. Thanks.


#2

ES6 added new features to the language, such as block-scoping, constants, arrow functions, default parameters, string interpolation, new built-in methods, etc.

This site lists them and does comparisons.
http://es6-features.org


#3

The latest version of JavaScript adds functionalities that make JavaScript programming better, faster and sometimes easier. The additional functionalities can all be written in vanilla JavaScript which is what Babel does (Babel is a transpiler, it compiles ECMA6 to normal JavaScript).

Other things are added to make more sense in the code you write, like classes and interfaces.

Typescript is a layer above JavaScript, in fact, you could write normal JavaScript in a .ts file and it would still work. Typescript is a compiled language based on JavaScript, this means that it must be compiled to JavaScript for it to work outside of your computer installation. It’s useful because it makes your code look better and you learn a lot from it because it’s statistically typed, this means that you have to define the type of data that is used or accepted by the functions, variables, objects, arrays and other things.


#4

Thanks very much for that @kevcomedia . Useful website.


#5

Thanks @lorepieri. That explains things well , thank you. Typescript would be useful to learn. Firstly, i will just get to grips with javascript (including use of classes and objects) and then move onto something like Typescript.
cheers!
David


#6

A number of ES6 features have NO ES5 analog, and functionality cannot be written conveniently or (in practice) bug-free in ES5. Examples are: Proxies, Symbols, Maps, Sets. There are notational features such as destructuring, arrow functions and the keyword super where the functionality is in ES5 but the actual use is much more awkward in ES5 (particularly true for super). And this just touches the surface.

In principle, you can do anything with ES5. The issues tend to center around convenience, maintenance, ways-of-thinking and just the sheer amount of work needed to do something. Think of the difference between Python and C, or anything and assembler. After all, originally C++ compiled down into C.

There’s lots of stuff on the web. But the best BOOK I have seen, which is clear and exhaustive, is “Understanding ECMAScript 6” by Nicholas C. Zakas. I highly recommend it and, probably, it will save you a huge amount of time. The bible for ES5 is “Javascript: the definitive guide” by David Flanagan.