문제

I'm struggling with learning the ins and outs of JavaScript and recently found out that ECMAScript 6 is on its way in-- it seems more and more trivial to learn things that will soon change and be on their way out. I don't know if it's worth it to dive into the intricate details of a ECMAScript5 when a new version is coming out. How should I prepare myself as a programmer for ECMAScript 6 and more generally how do I prepare for evolving languages?

도움이 되었습니까?

해결책

Javascript in context of the web (if that's what you're talking about) is a very different beast.

You need to understand engine deviations and limitations.

Embrace graceful degradation.

Some engines implement ES3. Others fully replaced ES3 conformance with ES5. Some even start to slowly add ES6 features. And to top it all of, some browsers also have non-standard additions that aren't part of either ES3, ES5, or ES6.

You need to deal with all that :)

The good thing is that a big chunk of the language stays unchanged. Even when new features are introduced in some browsers, there's still a trail of older generation engines that usually need to be supported.

You can't go wrong learning ES5 right now; just keep in mind that older browsers don't have some of the new features.

Here's ES5 compatibility table across most popular browsers.

And here's the one for ES6.

You can clearly see current state of affairs.

If you're interested in non-standard ES features, take a look at this.

다른 팁

Last I head, ES6 was due out by the end of this year. I'm becoming skeptical whether it's going to make the deadline, but even if it does it'll still take time for browsers to adopt it. And even after browsers adopt it, you'll have to wait until a significant portion of users update their browsers before you can really start using ES6 in production.

Take a note from the past: ES5 came out at the very end of 2009. Although I've been using ES5 in some small side-projects for about a year now, I just got permission to start using it at my workplace, as we're dropping support for browsers that don't support it. However, our clients are limited and more tech-savvy than the general population, and at many work places ES3 is still the standard.

I imagine the adoption of ES6 on the browser will take a similar amount of time, which means for the next 3-4 years (at least) browser developers are going to be living in an ES5 world (the change will be much quicker for Node, though).

In addition, nothing from ES1-5 is going away. Browsers have a hard rule that no new versions of JavaScript can be backwards incompatible with old versions. The ECMAScript committee is devoted to the "1 JS" philosophy, and more-or-less the goal is that every piece of JS code written in 1995 will run in 2015.

So ES5 is more-or-less just a subset of ES6. If you learn ES5 first, you can then keep all that knowledge in-tact and add to it when you start learning ES6. I would highly recommend that you just start getting a good foundation in ES3/5 for now, and just when your interest is piqued take a look at what's going on in ES6.

The differences are usually only noticeable to users who use specific functionality that isn't often used on most websites.

If you learn JavaScript right now, you will not be lost in any way when ECMAScript6 is out, the only difference it will make is that there will be new functionality that you may or may not find useful for your use cases, and which you can choose to use or not.

In short : Don't restrict your learning because a new version will come out, it won't negatively affect you in any way.

EDIT : In fact, firefox already supports some functionality from ECMAScript6 :

https://developer.mozilla.org/en-US/docs/Web/JavaScript/ECMAScript_6_support_in_Mozilla

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top