JavaScript 和 JScript 有什么区别?

发布于 2024-07-06 16:03:17 字数 44 浏览 14 评论 0原文

我一直想知道 JScript 和 JavaScript 之间的区别是什么。

I have always wondered WHaT tHE HecK?!? is the difference between JScript and JavaScript.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(13

半岛未凉 2024-07-13 16:03:17

只是真正的 ECMAScript 的名称不同。 John Resig 有一个很好的解释

以下是完整版本细分:

  • IE 6-7 支持 JScript 5(相当于 ECMAScript 3、JavaScript 1.5)
  • IE 8 支持 JScript 6(相当于 ECMAScript 3、JavaScript 1.5 - 比 JScript 5 修复了更多错误)
  • Firefox 1.0 支持JavaScript 1.5(相当于 ECMAScript 3)
  • Firefox 1.5 支持 JavaScript 1.6(1.5 + Array Extras + E4X + 杂项)
  • Firefox 2.0 支持 JavaScript 1.7(1.6 + 生成器 + 迭代器 + let + 杂项)
  • Firefox 3.0 支持 JavaScript 1.8(1.7 + 生成器表达式) + 表达式闭包 + 杂项。)
  • Firefox 的下一个版本将支持 JavaScript 1.9(1.8 + 待定)
  • Opera 支持相当于 ECMAScript 3 + Getters 和 Setters + 杂项的语言。
  • Safari 支持相当于 ECMAScript 3 + Getters 和 Setters + 杂项的语言。

Just different names for what is really ECMAScript. John Resig has a good explanation.

Here's the full version breakdown:

  • IE 6-7 support JScript 5 (which is equivalent to ECMAScript 3, JavaScript 1.5)
  • IE 8 supports JScript 6 (which is equivalent to ECMAScript 3, JavaScript 1.5 - more bug fixes over JScript 5)
  • Firefox 1.0 supports JavaScript 1.5 (ECMAScript 3 equivalent)
  • Firefox 1.5 supports JavaScript 1.6 (1.5 + Array Extras + E4X + misc.)
  • Firefox 2.0 supports JavaScript 1.7 (1.6 + Generator + Iterators + let + misc.)
  • Firefox 3.0 supports JavaScript 1.8 (1.7 + Generator Expressions + Expression Closures + misc.)
  • The next version of Firefox will support JavaScript 1.9 (1.8 + To be determined)
  • Opera supports a language that is equivalent to ECMAScript 3 + Getters and Setters + misc.
  • Safari supports a language that is equivalent to ECMAScript 3 + Getters and Setters + misc.
晨敛清荷 2024-07-13 16:03:17

据我所知,有两件事:

  1. ActiveXObject 构造
  2. 函数 习惯用法 f(x) = y,大致相当于 f[x] = y。

As far as I can tell, two things:

  1. ActiveXObject constructor
  2. The idiom f(x) = y, which is roughly equivalent to f[x] = y.
多孤肩上扛 2024-07-13 16:03:17

来自维基百科:http://en.wikipedia.org/wiki/Jscript

JScript 是 Microsoft 的方言
ECMAScript 脚本语言
规格。

JavaScript(Netscape/Mozilla
ECMA的实施
规范)、JScript 和
ECMAScript 是非常相似的语言。
事实上,“JavaScript”这个名字经常被
用于引用 ECMAScript 或
JScript。

Microsoft 在其实现中使用 JScript 名称以避免商标问题(JavaScriptJavaScript 的商标="http://tsdr.uspto.gov/#caseNumber=75026640&caseType=SERIAL_NO&searchType=statusSearch" rel="noreferrer">Oracle 公司)。

From Wikipedia: http://en.wikipedia.org/wiki/Jscript

JScript is the Microsoft dialect of
the ECMAScript scripting language
specification.

JavaScript (the Netscape/Mozilla
implementation of the ECMA
specification), JScript, and
ECMAScript are very similar languages.
In fact the name "JavaScript" is often
used to refer to ECMAScript or
JScript.

Microsoft uses the name JScript for its implementation to avoid trademark issues (JavaScript is a trademark of Oracle Corporation).

王权女流氓 2024-07-13 16:03:17

JScript 是 Microsoft 对 ECMAScript 规范的实现。 JavaScript 是该规范的 Mozilla 实现。

JScript is Microsoft's implementation of the ECMAScript specification. JavaScript is the Mozilla implementation of the specification.

轮廓§ 2024-07-13 16:03:17

Javascript 这种语言最早诞生于 Netscape。

Microsoft 对 Javascript 进行了逆向工程,并将其命名为 JScript,以避免与 Sun 发生商标问题。 (Netscape 和 Sun 当时是合作伙伴,所以这不是什么问题)

语言是相同的,都是 ECMA 脚本(事后标准)的方言。

尽管语言相同,但由于 JScript 在 Internet Explorer 中运行,因此它可以访问浏览器公开的不同对象(例如 ActiveXObject)

Javascript, the language, came first, from Netscape.

Microsoft reverse engineered Javascript and called it JScript to avoid trademark issues with Sun. (Netscape and Sun were partnered up at the time, so this was less of an issue)

The languages are identical, both are dialects of ECMA script, the after-the-fact standard.

Although the languages are identical, since JScript runs in Internet Explorer, it has access to different objects exposed by the browser (such as ActiveXObject)

姜生凉生 2024-07-13 16:03:17

很久以前,所有浏览器提供商都在为他们的浏览器制作 JavaScript 引擎,只有他们和上帝知道里面发生了什么。 一个美好的一天,ECMA 国际组织过来说道:让我们根据通用标准来制造引擎,让我们做一些通用的东西,让生活变得更加轻松和有趣,他们制定了这个标准。
由于所有浏览器提供商都将其 JavaScript 引擎基于 ECMAScript 核心(标准)。

例如,Google Chrome 使用 V8 引擎,并且这是开源的。 您可以下载它并查看 C++ 程序如何将 JavaScript 的命令“打印”转换为机器代码。

Internet Explorer 使用 JScript (Chakra) 引擎作为其浏览器,其他浏览器也这样做,并且它们都使用通用核心。

Long time ago, all browser providers were making JavaScript engines for their browsers and only they and god knew what was happening inside this. One beautiful day, ECMA international came and said: let's make engines based on common standard, let's make something general to make life more easy and fun, and they made that standard.
Since all browser providers make their JavaScript engines based on ECMAScript core (standard).

For example, Google Chrome uses V8 engine and this is open source. You can download it and see how C++ program translates a command 'print' of JavaScript to machine code.

Internet Explorer uses JScript (Chakra) engine for their browser and others do so and they all uses common core.

北方。的韩爷 2024-07-13 16:03:17

JScript 是 Javascript 的 Microsoft 实现

JScript is the Microsoft implementation of Javascript

不即不离 2024-07-13 16:03:17

根据这篇文章:

  • JavaScript是一种脚本语言由 Netscape Communications 开发,旨在开发客户端和服务器 Internet 应用程序。 Netscape Navigator 旨在解释嵌入到网页中的 JavaScript。 JavaScript 独立于Sun Microsystem 的Java 语言。

  • Microsoft JScript 是 Netscape JavaScript 的开放实现。 JScript 是一种高性能脚本语言,旨在为万维网创建活跃的在线内容。 JScript 允许开发人员链接和自动化网页中的各种对象,包括 ActiveX 控件和 Java 程序。 Microsoft Internet Explorer 旨在解释嵌入到网页中的 JScript。

According to this article:

  • JavaScript is a scripting language developed by Netscape Communications designed for developing client and server Internet applications. Netscape Navigator is designed to interpret JavaScript embedded into Web pages. JavaScript is independent of Sun Microsystem's Java language.

  • Microsoft JScript is an open implementation of Netscape's JavaScript. JScript is a high-performance scripting language designed to create active online content for the World Wide Web. JScript allows developers to link and automate a wide variety of objects in Web pages, including ActiveX controls and Java programs. Microsoft Internet Explorer is designed to interpret JScript embedded into Web pages.

有一些代码差异需要注意。

不支持 subtr 的第一个参数为负,例如在 Javascript 中:"string".substr(-1) 返回 "g",而在 JScript 中:"string".substr(-1 ) 返回“string”

在 Javascript 中可以使用 "string"[0] 来获取“s”,但 JScript 不支持这样的构造。 (实际上,只有现代浏览器似乎支持 "string"[0] 构造。

There are some code differences to be aware of.

A negative first parameter to subtr is not supported, e.g. in Javascript: "string".substr(-1) returns "g", whereas in JScript: "string".substr(-1) returns "string"

It's possible to do "string"[0] to get "s" in Javascript, but JScript doesn't support such a construct. (Actually, only modern browsers appear to support the "string"[0] construct.

浸婚纱 2024-07-13 16:03:17

维基百科有这个来说明这些差异。

一般来说,JScript 是一种 ActiveX 脚本语言,非 IE 浏览器可能将其解释为 JavaScript。

Wikipedia has this to say about the differences.

In general JScript is an ActiveX scripting language that is probably interpreted as JavaScript by non-IE browsers.

飘过的浮云 2024-07-13 16:03:17

JScript 和 Javascript 是完全不同的脚本语言。 Javascript 在浏览器上运行,但 JScript 可以使用 ActiveX 对象,并且如果运行它,它几乎可以完全控制您的操作系统,它可以删除文件、运行或写入文件、从网络下载文件(通过 Powershell)运行 cmd 命令JScript 与 VBScript 几乎相同,但语法不同。

JScript and Javascript is TOTALLY different scripting languages. Javascript runs on the browser, but JScript can use ActiveX objects and has almost total control on your operating system if you've ran it, it can delete files, run or write files, download files from the web(via Powershell) run cmd commands etc. JScript is almost the same thing as VBScript, but has different syntax.

﹎☆浅夏丿初晴 2024-07-13 16:03:17

Jscript 是一种类似于 C# 的 .NET 语言,具有相同的功能并可访问所有 .NET 功能。

JavaScript 在 ASP Classic 服务器上运行。 使用经典 ASP 运行客户端上相同的 JavaScript(不包括 HTML5 功能)。 对于我的大部分代码来说,我只有一组代码。

当我需要经典 ASP 中没有的图像和二进制文件功能(以及许多其他功能)时,我运行 .ASPX JScript。 该代码对于服务器来说是唯一的,但功能非常强大。

Jscript is a .NET language similar to C#, with the same capabilities and access to all the .NET functions.

JavaScript is run on the ASP Classic server. Use Classic ASP to run the same JavaScript that you have on the Client (excluding HTML5 capabilities). I only have one set of code this way for most of my code.

I run .ASPX JScript when I require Image and Binary File functions, (among many others) that are not in Classic ASP. This code is unique for the server, but extremely powerful.

人疚 2024-07-13 16:03:17

JScriptMicrosoftJavaScript 等价物。
Java 是Oracle 产品,曾经是Sun 产品。

甲骨文收购了Sun

JavaScript + Microsoft = JScript

JScript is Microsoft's equivalent of JavaScript.
Java is an Oracle product and used to be a Sun product.

Oracle bought Sun.

JavaScript + Microsoft = JScript

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文