@wallhackio Please educate me about the differences between ES5 and ES6
@vaporeon_ are you familiar with the term ecmascript?
@wallhackio That's the proper name for what's commonly called JavaScript, right? I once saw a print-out of the ECMAscript standard, but I didn't pick it up, unfortunately
@vaporeon_ sun microsystems trademarked JavaScript in the 90s because of course they did, so when JavaScript was standardized (I believed in 1997?) the committee was not sure if they had the rights to publish a document with that term.
they were going to call it LiveScript (or was it ActionScript? i forgot which) but Netscape had also trademarked that name and as such the committee wasn't sure if they could use that name either.
the group which standardized JavaScript was, at the time, part of the European Computer Manufacturer's Association, or ECMA for short, and since they ran out of time before both Sun and Netscape could get back to them regarding the preferred names, the committee decided to settle with the name ECMAScript. Nobody liked the name but it was chosen and now it stuck.
@vaporeon_ regarding ES5 and ES6:
The language had a small spec update in 1998 (ES2) and then a more significant update in 1999 (ES3). ES3 is when the language really caught on.
ES4 was then developed for many years but due to political differences, poor management, and concerns of growing complexity in the proposals, it was tossed and the committee started over. They were not able to come to a consensus on a new update to the language until 2009, at which point they decided to call the spec ES5 instead of ES4 for some reason.
ES6 was then developed in 2015 and was the most impactful update the language specification. It introduced an entire new syntax for declaring functions, new syntax for declaring variables, promises (a built-in abstraction for concurrency/asynchronous programming), template strings, generator functions, weak references, and so much more. It completely changed the language. (Mostly) for the better.
@wallhackio @vaporeon_ ES6 was not more impactful than ES5 in terms of the fundamental behaviours of the language, as ES5 added strict mode, getters and setters, low‐level things like Object.getPrototype, Object.setPrototype, and Object.defineProperty, and so forth. Most ES6 code can be transpiled into equivalent ES5 code, whereas ES5 introduced fundamental concepts around writability, enumerability, an access which could not be ported back to ES3. However, most programmers do not take advantage of the unique qualities of JavaScript introduced by ES5 and ES6 introduced more syntactic sugar for common operations. In addition, when ES6 came out, people created transpilers back to ES5 so the ES6/ES5 distinction was more firmly established in people’s minds.
@vaporeon_ @wallhackio to answer question 1, basically when JavaScript was first introduced they made a small number of decisions which they later decided were REALLY questionable in terms of the security of programs. ES5 added a new mode, called "strict mode", which disabled these features. in “ordinary” JavaScript code, you have to opt into strict mode using what is called a “directive”. but when they added modules in ES6 (probably the most significant ES6 addition), they mandated that any code loaded as a module is unconditionally in strict mode. (you should always run javascript as a module if you can in the present day.)
to answer question 2, browsers don’t implement JavaScript by versions, they do it by features. so, for example, the JavaScript standard has mandated that browsers implement optimizations for “tail calls” (in ES6 i believe?) but only Safari ever did. however, many browsers have implemented lots of features from newer versions even though they didn’t implement that one and so technically don’t have full ES6 conformance. so you have to do a feature‐by‐feature comparison rather than being able to say “this browser completely supports this version”. (also there is more to browser javascript than ECMAscript; there is also the DOM which historically has willfully violated the ECMAscript spec in a few places even.) but there are websites which will do this comparison and list which features a browser supports (usually i think in terms of which test cases it passes/fails from a test suite).