JavaScript、JScript 和 ECMAScript 之间有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12051002/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 15:10:49  来源:igfitidea点击:

What's the difference between JavaScript, JScript & ECMAScript?

javascriptjscript

提问by Matthew Layton

OK, so I'm trying to learn JavaScript properly so that I can write good, clean client-side code, but whenever I think I'm making progress, something stops me dead in my tracks!

好的,所以我正在尝试正确地学习 JavaScript,以便我可以编写好的、干净的客户端代码,但是每当我认为我正在取得进展时,就会有一些事情阻止我死在我的轨道上!

I want to know:

我想知道:

  1. What is the different between JavaScript, ECMAScript and JScript?

  2. Which should I focus on learning?

  3. If these are versioned, which version should I be supporting?

  4. Are there any really good references (web / books etc) that are a must have/read?

  5. How do I ensure that what I write will be compliant with all major browsers (IE, FF, Safari, Chrome, Opera etc.) ?

  6. MOST IMPORTANTLY...Is there a reference of the core objects (Array, Number etc) so I know what is implemented already and what I need to do myself?

  1. JavaScript、ECMAScript 和 JScript 之间有什么区别?

  2. 我应该重点学习哪个?

  3. 如果这些是版本化的,我应该支持哪个版本?

  4. 是否有任何必须拥有/阅读的非常好的参考资料(网络/书籍等)?

  5. 我如何确保我编写的内容与所有主要浏览器(IE、FF、Safari、Chrome、Opera 等)兼容?

  6. 最重要的是......是否有核心对象(数组、数字等)的引用,所以我知道已经实现了什么以及我需要自己做什么?

Thanks.

谢谢。

采纳答案by Guffa

Javascript is the original name when the language was developed by Netscape.

Javascript 是 Netscape 开发该语言时的原始名称。

JScript is Microsoft's name of their own implementation.

JScript 是微软自己实现的名称。

ECMAScript is the name of the language standard developed by ECMA, from the original Javascript implementation.

ECMAScript 是 ECMA 开发的语言标准的名称,源自原始的 Javascript 实现。

So, it's just one language, with different implementations.

所以,它只是一种语言,具有不同的实现。

The implementations of Javascript and JScript differ somewhat in what they support, but each version supports what's in the corresponding version of the ECMAScript standard. Generally you just use what's supported a few versions back, so that it works in all the browsers that are still in use.

Javascript 和 JScript 的实现在它们支持的内容上有所不同,但每个版本都支持 ECMAScript 标准的相应版本中的内容。通常,您只需使用几个版本支持的内容,以便它在仍在使用的所有浏览器中工作。

One reference is the Mozilla Developer Network, as Mozilla is the current developer of Javascript. For each method and property you can find which version it is supported in.

一个参考是Mozilla 开发者网络,因为 Mozilla 是当前的 Javascript 开发者。对于每个方法和属性,您都可以找到它支持的版本。

JScript is documented at the Microsoft Developer Network, and has similar information about support. (Note that all Microsoft documentation is there, not only JScript, so for example you would need to search for "jscript array" rather than just "array".)

JScript 记录在Microsoft Developer Network 中,并且有关于支持的类似信息。(请注意,所有 Microsoft 文档都在那里,而不仅仅是 JScript,因此例如您需要搜索“jscript 数组”而不仅仅是“数组”。)

Using a library like jQuery is useful to avoid dealing with some of the compatibility problems between browsers.

使用像 jQuery 这样的库有助于避免处理浏览器之间的一些兼容性问题。

回答by pkurek

  1. ECMAScript is the scripting language standardized by Ecma International in the ECMA-262 specification and ISO/IEC 16262. The language is widely used for client-side scripting on the web, in the form of several well-known dialects such as JavaScript, JScript, and ActionScript.

  2. Depends on you, but I think most commonly used for web dev is JavaScript

  3. JavaScript was formalized in the ECMAScript language standard and is primarily used in the form of client-side JavaScript

  4. I would recommend thisbook

  5. By learning more and more about the language itself and writing tests

  6. Look here

  1. ECMAScript 是 Ecma International 在 ECMA-262 规范和 ISO/IEC 16262 中标准化的脚本语言。 该语言广泛用于 Web 上的客户端脚本,以 JavaScript、JScript、和动作脚本。

  2. 取决于你,但我认为最常用于 Web 开发的是 JavaScript

  3. JavaScript 在 ECMAScript 语言标准中正式化,主要以客户端 JavaScript 的形式使用

  4. 我会推荐本书

  5. 通过越来越多地了解语言本身并编写测试

  6. 这里

回答by LuigiEdlCarno

It is important to understand, that ECMAScript is a standard, defined in the last century. :D Whereas Javascript is derived from ECMAScript. Derived in a sense, that it implements the standard.

重要的是要理解,ECMAScript 是一个标准,定义于上个世纪。:D 而 Javascript 是从 ECMAScript 派生的。从某种意义上说,它实现了标准。

The big difference is, that Javascript actually only exists within the Browser, saying, it is by no means a standard in itself. Every browser can (and a lot do) implement it's own methods.

最大的不同在于,Javascript实际上只存在于浏览器中,也就是说,它本身绝不是一个标准。每个浏览器都可以(并且很多都可以)实现它自己的方法。

So, if you seriously want to learn it and write clean code, then IMHO you have to first get familiar with the ECMAScript standard.

因此,如果您真的想学习它并编写干净的代码,那么恕我直言,您必须首先熟悉 ECMAScript 标准。

To 3: Since Javascript is implemented by the browser, this really depends on what browsers you want to develop code for. Older browser may have to be dealt with trought some seperate handling in your code.

To 3:由于 Javascript 是由浏览器实现的,这实际上取决于您要为其开发代码的浏览器。旧浏览器可能需要在您的代码中进行一些单独的处理。

To 5: Again, javascript can check what browser (or what client software in general) requestet the page it is loaded in. Meaning: If bad comes to worse, you can deal with each browser seperately in your code. But most of the time they are pretty compliant (at least the later versions)

To 5:同样,javascript 可以检查什么浏览器(或一般的客户端软件)请求它加载的页面。意思是:如果情况变得更糟,您可以在代码中单独处理每个浏览器。但大多数时候它们都非常合规(至少是更高版本)

On 4 and 6 I'd have to check first for myself.

在 4 点和 6 点,我必须先自己检查。

Hope I could help you out a bit.

希望我能帮到你一点。

Regards

问候

回答by sQVe

  1. ECMAScript is the language, JavaScript and JScript are dialects

  2. I would, personally, look at and learn JavaScript.

  3. It depends on what browsers you want to support, easily googled.

  4. MDNis a pretty good web source. JavaScript: The Good Partsand JavaScript: The Definitive Guideare both very good books, the first short and concise the latter very detailed.

  5. JavaScript libraries like jQuery is very good for this reason. It all comes down to learning all the quirks of the browsers. Google is your friend.

  6. MDN.

  1. ECMAScript 是语言,JavaScript 和 JScript 是方言

  2. 我个人会研究和学习 JavaScript。

  3. 这取决于您想要支持的浏览器,很容易用谷歌搜索。

  4. MDN是一个非常好的网络资源。JavaScript: The Good PartsJavaScript: The Definitive Guide都是很好的书,第一本简短而简洁,后者非常详细。

  5. 由于这个原因,像 jQuery 这样的 JavaScript 库非常好。这一切都归结为学习浏览器的所有怪癖。谷歌是你的朋友。

  6. MDN

回答by Paul Osborne

  1. They're one and the same - for an history on JavaScript watch the Douglas Crockford webcasts on YouTube.
  1. 它们是相同的 - 要了解 JavaScript 的历史,请观看 YouTube 上的 Douglas Crockford 网络广播。

http://youtu.be/_DKkVvOt6dkhttp://youtu.be/hQVTIJBZook

http://youtu.be/_DKkVvOt6dkhttp://youtu.be/hQVTIJBZook

2,3,4. Start with this http://eloquentjavascript.net/

2、3、4。从这个http://eloquentjavascript.net/开始

  1. Libraries like jQuery do a good job in normalising behaviour across browsers.

  2. I thinkthis is what you are looking for http://dochub.io/#javascript/

  1. 像 jQuery 这样的库在规范跨浏览器的行为方面做得很好。

  2. 认为这就是你要找的http://dochub.io/#javascript/

回答by 3on

  1. Wikipedia please.
  2. Javascript is a language, this is probably what you want to learn rather than a spec.
  3. Welcome in hell, all. Modernizrand jQueryexists for a reason. Unless you are doing Javascript on the server side with Node.js for example, in this case you can focus on only one JS Engine (V8 for Node).
  4. MDN
  5. Test, Test, Test and re Test. Try never to use too recent features and use libraries.
  6. MDN tells you which browser supports what.
  1. 请维基百科。
  2. Javascript 是一种语言,这可能是您想要学习的而不是规范。
  3. 欢迎来到地狱,大家。ModernizrjQuery 的存在是有原因的。例如,除非您使用 Node.js 在服务器端执行 Javascript,否则在这种情况下,您只能专注于一个 JS 引擎(V8 for Node)。
  4. MDN
  5. 测试,测试,测试和重新测试。尽量不要使用太新的功能并使用库。
  6. MDN 告诉你哪个浏览器支持什么。