最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

mozilla - What is the correlation between ECMAScript 5 and JavaScript 1.8.5 in terms of language features? - Stack Overflow

programmeradmin4浏览0评论

I've been reading up on Mozilla's continuing development of JavaScript, up through version 1.8.5: .

My question is: What is the correlation between JavaScript 1.8.5+ and ECMAScript 5+ in terms of language features? Any chance Mozilla's new JavaScript features (like generators, array comprehensions, etc.) will become part of ECMAScript?

I just want to get a handle on whether it's worth learning JavaScript 1.8.5 features (and working to shim them into non-supporting browsers) or whether I should forget JS 1.8.5 and focus on learning/shimming the new ECMAScript 5 features.

FYI: Mozilla talks about how they're planning to bring JavaScript into compliance with ECMAScript 5 here:

I've been reading up on Mozilla's continuing development of JavaScript, up through version 1.8.5: https://developer.mozilla.org/en/JavaScript.

My question is: What is the correlation between JavaScript 1.8.5+ and ECMAScript 5+ in terms of language features? Any chance Mozilla's new JavaScript features (like generators, array comprehensions, etc.) will become part of ECMAScript?

I just want to get a handle on whether it's worth learning JavaScript 1.8.5 features (and working to shim them into non-supporting browsers) or whether I should forget JS 1.8.5 and focus on learning/shimming the new ECMAScript 5 features.

FYI: Mozilla talks about how they're planning to bring JavaScript into compliance with ECMAScript 5 here: https://developer.mozilla.org/En/JavaScript/ECMAScript_5_support_in_Mozilla

Share Improve this question edited Feb 4, 2011 at 1:17 Roy Tinker asked Feb 4, 2011 at 1:06 Roy TinkerRoy Tinker 10.2k4 gold badges43 silver badges59 bronze badges 20
  • 3 I for one don't want the pythonisation that mozilla is bringing. – Raynos Commented Feb 4, 2011 at 1:17
  • 1 My big question is when Javascript is finally going to be able to handle Unicode in its regexes, at least up to Level 1 compliance with UTS#18: “Basic Unicode Support”. It’s tantamount to useless in today’s post-ASCII world without it. – tchrist Commented Feb 4, 2011 at 1:25
  • Me neither, I think some of the features are cool, but it's overkill, pythonization is a good way to put it. The only thing I want is the ability to declare types if I chose to (like ActionScript) – Ruan Mendes Commented Feb 4, 2011 at 1:25
  • @JuanMendes let's not bring in strict typing please! Imagine if jQuery enforced strict typing internally. We would all have to start using it. It's not an optional thing with those popular 3rd party libraries we rely on. – Raynos Commented Feb 4, 2011 at 1:30
  • 1 @JuanMendes I use prototyped OO and functional code. I don't write procedural code. I just never have a use for type checking. I write a development version of my code with debugging statements and tests all over the place, then get a compiler to strip it out. It also helps more then hinders as the high level design stays consistant. – Raynos Commented Feb 4, 2011 at 1:59
 |  Show 15 more comments

3 Answers 3

Reset to default 16

JavaScript 1.8.5 is Mozilla's implementation of ECMAScript with added features. It's a superset of the ECMAScript specification (and of current implementations like IE, Chrome and Opera). Mozilla pushes for the features it adds to its own browser, they may or may not make it into ECMA. Note that Mozilla is a member of the W3C and has some say, but my guess is that most features won't make it.

Bottom Line Don't use it unless you're coding something specific to firefox, FF extensions, XUL apps, Rhino (Added Rhino thanks to @Raynos)

Defiantly focus on ES5. The issue with 1.7 & 1.8 features is that they change the syntax of the language so you can't shim them into other code.

You can emulate all the properties of the Object with ES5 but you can't emulate the let keyword. In other browsers the various expression are just not valid javascript.

You must distinquish between making addition to native code which is what most of ES5 is doing and changing the syntax of javascript which is what 1.7 & 1.8 are doing.

There is a use for 1.7 & 1.8 which is to develop for the RHINO platform. But for browser javascript stick to the spec.

Admittedly the multiple value returns is a pretty neat feature. Having an array assignment like that would be nice

function() f {
     return [1,2,3];
}

[a,b,c] = f()

But the other features are quite major changes to the syntax and you just can't push them through ecmascript they just won't deal with it. Small changes like above you might be able to get into ES6 but your going to have to wait at least a year.

So realistically don't expect the learning to pay off for a year or two if at all. Most likely it won't pay off. Do look at libraries such as underscore.js which can define common functional utility methods for you.

I think ECMAScript is the "standard", like a blueprint, and javascript is the actual language it is based off of. Kind of like how w3c has their standards and then people make (or don't) make rendering engines based off it.

So basically to answer your question, look at ECMAScript to see what the consensus is, how javascript is "supposed" to work, but you should focus on javascript, because that's what you will actually be coding with.

发布评论

评论列表(0)

  1. 暂无评论