125

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

theonlygusti
  • 11,032
  • 11
  • 64
  • 119
Brian G
  • 53,704
  • 58
  • 125
  • 140
  • I'm sure it's already been pointed out, but IE, you can't use `const` keyword to declare variables: const MY_CONSTANT = 10; – dplante Jun 05 '09 at 22:07

13 Answers13

88

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.
Zach
  • 24,496
  • 9
  • 43
  • 50
  • 17
    This is wrong. JScript supports some syntax features not present in JavaScript, including `f(x) = y`. See [this question](http://stackoverflow.com/questions/18838213/property-bag-in-javascript/18838507) for more. – Asad Saeeduddin Sep 17 '13 at 19:21
  • 4
    @Malachi I don't need to. [Patrick's answer](http://stackoverflow.com/a/135256/1726343) is correct. – Asad Saeeduddin Oct 02 '13 at 20:47
39

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.
Patrick
  • 90,362
  • 11
  • 51
  • 61
20

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).

basher
  • 2,381
  • 1
  • 23
  • 34
casademora
  • 67,775
  • 17
  • 69
  • 78
  • 8
    This doesn't answer the question at all. The question is: "What are the differences between JavaScript and JScript". The [correct answer](http://stackoverflow.com/a/135256/1726343) is buried under several reiterations of the same thing. – Asad Saeeduddin Sep 17 '13 at 19:24
7

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

Thomas Owens
  • 114,398
  • 98
  • 311
  • 431
7

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)

Alana Storm
  • 164,128
  • 91
  • 395
  • 599
4

JScript is the Microsoft implementation of Javascript

James Boother
  • 41,623
  • 1
  • 17
  • 5
4

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.

Christophe Herreman
  • 15,895
  • 9
  • 58
  • 86
  • 3
    @phrj: this is the Humpty Dumpty definition of "Open". AFAIK, it means "orthogonal". – Shog9 Sep 27 '08 at 20:26
  • 7
    Calling JScript "high-performance" back in the pre-V8 era makes one realize how far we have come. – Ray Toal Oct 09 '11 at 22:38
  • 9
    The second list item looks like advertising material - "open implementation" actually means "you have to be open minded to accept it", and "high-performance" means "meant to be run on a high-performance machine". – Camilo Martin Sep 02 '12 at 07:56
  • why netscape did not made a lawsuit against microsoft for implementing javascript? – ezio Aug 29 '22 at 13:18
4

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.

Pang
  • 9,564
  • 146
  • 81
  • 122
3

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.

Shiraz
  • 2,310
  • 24
  • 26
1

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.

erlando
  • 6,736
  • 4
  • 24
  • 29
0

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.

cigien
  • 57,834
  • 11
  • 73
  • 112
webexpert
  • 1
  • 1
  • 1
    Welcome to Stack Overflow! Please don't vandalize your posts. By posting on the Stack Exchange network, you've granted a non-revocable right, under the [CC BY-SA 4.0 license](https://creativecommons.org/licenses/by-sa/4.0/), for Stack Exchange to distribute that content (i.e. regardless of your future choices). By Stack Exchange policy, the non-vandalized version of the post is the one which is distributed, and thus, any vandalism will be reverted. – cigien Jul 31 '22 at 16:01
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 02 '22 at 09:28
-5

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.

Clif
  • 1
-8

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

raven myers
  • 585
  • 1
  • 6
  • 5
  • 17
    Go easy on the bolds! – Jowen Apr 15 '14 at 08:32
  • Why Java? You meant JavaScript. – Stack0verflow Dec 09 '14 at 13:35
  • 1
    An important note for anyone that might not know: JavaScript and Java are not the same thing or related in any way. JavaScript was originally called LiveScript. But renamed to JavaScript to capitalize on the popularity of Java. Sharing the name is the extent of what they have in common aside from similarities with C like syntax languages. – Bacon Brad Jul 11 '19 at 22:44