What's the Difference Between JavaScript and Jscript

What's the difference between JavaScript and JScript?

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.

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

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

JScript is Microsoft's name of their own implementation.

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

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.

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.

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

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

What are the functional differences between JScript, JavaScript, and ECMA Script?

A implementation of the EMCAScript standard is more than code that brings the specification rules to life. The ECMAScript standard is deliberately incomplete:

Each Web browser and server that supports ECMAScript supplies its own host environment, completing the ECMAScript execution environment.

An ECMAScript implementation must supply a "host environment". In the case of a Web browser, that host environment includes DOM manipulation APIs and other APIs specified by the W3C and WHATWG. The behaviors of (indeed, the existence of) these APIs are not specified by ECMAScript.

Objects used to complete the "host environment" of an implementation are called "host objects". Host objects are not bound to follow normal object rules: they may throw errors for property access that would be valid on a native (non-host) object, or they might allow certain actions that would be natively disallowed.

JScript and JavaScript might implement their DOM APIs differently. Which implementation is "correct" on some particular point is not a matter of ECMAScript compliance, but rather a matter of compliance with W3C standards. Even if a DOM object seems to exhibit some behavior that runs contrary to "normal" ECMAScript behaviors (like your instanceof error example), it's still legal ECMAScript according to section 8.6.2:

Host objects may support these internal properties with any implementation-dependent behaviour as long as it is consistent with the specific host object restrictions stated in this document.

"Internal properties" here include logical operations like "getting the value of an object's property by name", codified as [[Get]]. A host object's custom [[Get]] implementation might throw an error, or ignore a previously-set property.

API differences are distinct from actual language differences. A language difference suggests a difference either in supported lexical grammar or in the behavior of native (non-host) objects. Some differences in actual language include:

  • JScript allows for cc_on comments that cause conditional compilation
  • Mozilla's JavaScript supports the yield keyword, and generators, and a bunch of other stuff that is not in the ES5 spec (but likely will be in ES6)
  • All browsers support function declarations in blocks, which is not legal ECMAScript syntax:

    function foo() {
    bar();

    if(condition) {
    function bar() { } // this is not legal
    }
    }

    Browsers that support this (i.e., all of 'em) are extending the ECMAScript language. Also, JScript will hoist bar in that example, while Mozilla's JavaScript will not. This is because the two browsers have extended the ECMAScript language in incompatible ways.

What is the difference between JavaScript and ECMAScript?

I think a little history lesson is due.

JavaScript was originally named Mocha and changed to Livescript but ultimately became JavaScript.

It's important to note that JavaScript came before ECMAscript and the history will tell you why.

To start from the beginning, JavaScript derived its name from Java and initially Brendan Eich (the creator of JS) was asked to develop a language that resembled Java for the web for Netscape.

Eich, however decided that Java was too complicated with all its rules and so set out to create a simpler language that even a beginner could code in. This is evident in such things like the relaxing of the need to have a semicolon.

After the language was complete, the marketing team of Netscape requested Sun to allow them to name it JavaScript as a marketing stunt and hence why most people who have never used JavaScript think it's related to Java.

About a year or two after JavaScript's release in the browser, Microsoft's IE took the language and started making its own implementations such as JScript. At the same time, IE was dominating the market and not long after Netscape had to shut its project.

Before Netscape went down, they decided to start a standard that would guide the path of JavaScript, named ECMAScript.

ECMAScript had a few releases and in 1999 they released their last version (ECMAScript 3) before they went into hibernation for the next 10 years. During this 10 years, Microsoft dominated the scenes but at the same time they weren't improving their product and hence Firefox was born (led by Eich) and a whole heap of other browsers such as Chrome, Opera.

ECMAScript released its 5th Edition in 2009 (the 4th edition was abandoned) with features such as strict mode. Since then, ECMAScript has gained a lot of momentum and is scheduled to release its 6th Edition in a few months from now with the biggest changes its had thus far.

You can use a list of features for ECMAScript 6 here http://kangax.github.io/es5-compat-table/es6/ and also the browser support. You can even start writing Ecmascript 6 like you do with CoffeeScript and use a compiler to compile down to Ecmascript 5.

Whether ECMAScript is the language and JavaScript is a dialect is arguable, but not important. If you continue to think like this it might confuse you. There is no compiler out there that would run ECMAScript, and I believe JavaScript is considered the Language which implements a standard called ECMAScript.

There are also other noticeable languages that implement ECMAScript such as ActionScript (used for Flash)

Why is JavaScript called JavaScript, since it has nothing to do with Java?

JavaScript was originally named Mocha, later it was renamed to LiveScript, and then to JavaScript.

The LiveScript to JavaScript name change came because Netscape and Sun did a license agreement.

The language was then submitted for standarization to the ECMA International Organization. By that time, Netscape didn't allow the use of the "JavaScript" name, so the standarized language is named ECMAScript.

JavaScript isn't actually an open name. It is currently a trademark of Oracle (formerly Sun).

There still a lot of confusion, some people still think that JavaScript, JScript, and ECMAScript are three different languages.

ECMAScript is the "standards" name for the language.

JavaScript is technically a "dialect" of ECMAScript, the Mozilla Foundation can use "JavaScript" as the name of their implementations (currently present on the Rhino and SpiderMonkey engines).

In the early days, Microsoft decided also to do what Netscape was doing on their own browser, and they developed JScript, which is also an ECMAScript dialect, but was named in this way to avoid trademark issues.

Difference between script/script and % %

The first example adds JavaScript to an HTML document where it will be interpreted by a web browser.

The second example adds program code (in any language, including JScript) to a Classic ASP program where it will be interpreted by a web server before being sent to a web browser.

Some other systems also use the <% syntax, including JSP (which is Java, not JavaScript).

Difference between ECMAScript6 and JavaScript

Javascript has had many names over the years and it is really just an implementation of ECMAscript.

It is a great idea to learn ES6 especially if you are doing any kind of web development.

Arrow functions and constants were introduced in ES6 and not everything that supports es5 supports es6 functionality. See this for an exhaustive list

So should you learn JS or start learning ES6? Either/both will serve you well. Personally I think the new features in ES6 may not be fully graspable until you learn the basic tenets of JS and you understand WHY they were introduced in ES6

Is there any reason to replace JavaScript with JScript in Internet Expolorer?

JScript and JavaScript are the same. They're just aliases for each other:

(via Wikipedia)

As explained by JavaScript guru Douglas Crockford in his talk entitled The JavaScript Programming Language on YUI Theater, "[Microsoft] did not want to deal with Sun about the trademark issue, and so they called their implementation JScript. A lot of people think that JScript and JavaScript are different but similar languages. That's not the case. They are just different names for the same language, and the reason the names are different was to get around trademark issues."

The only scripting differences between the 2 will be in cross-browser differences.

What's the difference between JavaScript and Java?

Java and Javascript are similar like Car and Carpet are similar.

What will be the status of the term JScript in MSDN?

EDIT: I thought this question was about the status of the implementation of Javascript in IE8. Note that "JScript" (ignore "JScript.NET") was historically the name given to Microsoft's "Active Scripting" implementation of ECMAScript, which I have described below:

JScript, as found in Internet Explorer versions 3 through version 8, is implemented using the Active Scripting engine, which is shared with the Windows Script Host for the execution of shell *.vbs and *.js files, and also shared by the server-side Classic ASP environment.

In the long-term Active Scripting looks to be deprecated: on the server-side Classic ASP is considered dead (last update was version 3.0 with Windows 2000 back in 1999), in the browser it has been replaced with the JIT "Chakra" engine in Internet Explorer 9, and in the shell it has been replaced with PowerShell.

However Microsoft will support Active Scripting for a while: Windows 8 provides full support for the system and Windows 8's support lifecycle shouldn't end until 2022 (assuming MS sticks to the 10-year lifecycle support policy).



Related Topics



Leave a reply



Submit