Absolutely agree. I was looking at this exact same thing last week. From what I'm come to understand from the overly bureaucratical responses I received from JavaScript community members, is that the language is designed with two intentions in mind:<p>1. Never break legacy code.
2. Be an open adaptable language that any developer from any background (or no background) can write code in.<p>It's a messy messy attempt at being the popular kid. For example, classes, a popular new feature of ES6 looks like this:<p>~~~<p>class Hello {<p><pre><code> constructor(name) {
this.name = name
}
hello() {
return 'Hello ' + this.name + '!'
}</code></pre>
}<p>~~~<p>Cool. However in ES5, this is how a class is created:<p>~~~<p>function Hello(name) {
this.name = name
}<p>Hello.prototype.hello = function hello() {
return 'Hello ' + this.name + '!'
}<p>~~~<p>Okay...this makes sense and while the ES6 version is syntactically cleaner, it breaks the paradigm set in ES5. Knowing what I know of other languages, I'd expect something like this:<p>~~~<p>class Hello {<p><pre><code> function constructor(name) {
this.name = name
}
function hello() {
return 'Hello ' + this.name + '!'
}</code></pre>
}<p>~~~<p>I was told the reason is that methods are not functions. Which is an okay reason, but wait, they are functions in ES5...<p>Furthermore, you can't use ES6 class syntax in non strict mode. At first I assumed a valiant attempt of deprecating older features, by requiring a strict mode as a sort of psuedo deprecation. However what stinks about this is that it still doesn't fix the issue 100%. There are already too many tutorials out there describing how to write bad JS code. What ultimately needs to happen, is that browsers, nodejs, etc, need to always operate with strict parsing. The "use strict" flag is too easily forgotten. Yes this will break programs that are 50 years old, but everything has to come to a halt eventually. Another solution would be to "fork" or start a new language from scratch to replace it. I'm aware this is the intention of Dart, however it's adoption rate seems too little to make an impact as evidence by it's lack of care to be included in Chrome even (<a href="https://www.dartlang.org/support/faq.html#q-will-the-dart-vm-get-into-chrome" rel="nofollow">https://www.dartlang.org/support/faq.html#q-will-the-dart-vm...</a>).