What’s the difference?

The other day a program manager on another team sent me a question that I've seen in various forms many times over the last few years.  The question was "Is there any documentation that describes all the differences between JScript and Javascript?"

This is definitely one of those questions where knowing what the questioner is really after is necessary before expending any serious effort.  Time for another bad analogy!

Is there any documentation that describes all the differences between American Standard English and British Standard English?  (“Two countries separated by the same language,” as Shaw said.)

You could scan the American Heritage Dictionary and maybe a few editions of Webster's into a computer, and do a complex textual difference against Chambers and a few other canonical British dictionaries.  That would at least give you differences in vocabulary -- we'd learn that those wacky Brits spell "manoeuvre" the fun way, and that "windshield" and "windscreen" are the same thing, and all that rubbish.  I mean, garbage.

But that's just vocab.  I was in Northern Ireland once visiting a Canadian friend whose roommates howled with laughter when she told them that I "gave her a ride all the way home".  Apparently that's some sort of double entendre in Portrush, or maybe they were just weirdoes, I don't know.  My point is that the number of subtle differences in meaning is enormous.

And that's just usage!  A proper document of the differences between American and British English would also have an analysis of some of the deeper structural and historical factors, and so on.  There are many thick books on this subject.

So if some inquisitive soul were to ask one for documentation on the differences between British and American English, it would probably behoove one to find out why they need this information before writing the doctoral dissertation.  What if you find out that "I need that documentation because I'm publishing a cookbook written by a British writer. I need to translate it into American Standard English" ?  Then that dissertation isn't really going to be that helpful, is it? 

I told the PM that the only definitive documentation that I know of that describes most of the differences between JScript and Javascript is the aptly named "Javascript: The Definitive Guide" by David Flanagan, published by O'Reilly.  The definitive doc which describes the commonalities is the ECMAScript specification.

Now, of course, those documents only describe differences and similarities in behaviour.  If you're interested in differences in implementation and the historical factors which led to those differences, then you're going to need to talk to the language designers who were in the ECMA working group.

Also, if you are looking for differences between the IE and Netscape browser object models, the Definitive Guide will help you out somewhat, but the ECMA specification will not.  You'll need to consult the W3C DOM specifications for that.  Remember, JScript and Javascript are languages independent of the browser object model.

And of course, it turned out that the reason the PM was asking in the first place is because a customer had written a script that ran in Netscape, and wanted to know if it would run in IE without changes. 

Well, the way to solve that problem is not to compile an exhaustive list of all the syntactic and semantic differences between JScript and Javascript, and then examine the program in the context of that list!  No more than the way to translate a cookbook from "kilograms of biscuits" to "pounds of cookies" is to compile a complete list of all the differences between American and British English!

There's an easier way to find out if that script works -- try it and see!  If it dies horribly then it probably doesn't work, so fix it and try again.  If you're worried about more subtle problems, write a series of unit tests and exercise them on both platforms until you're confident that the whole thing works the way you'd like. 

You'd have to do that regardless of whether you had a list of differences, so just do it!

Every now and then someone will ask me what the difference is between Java and Javascript.  I usually ask them right back what the difference between English and German is...

Comments (18)

  1. ben says:

    Heres a similar question. Using classic ASP, I can specify my Page Language will be VBScript, JScript, or JavaScript… and maybe others.

    In that case, there’s no difference between Jscript and Javascript, right?

  2. Eric Lippert says:

    Correct. ASP, IE, etc, will use JScript when you specify language=Javascript, ECMAScript, etc. They’re just aliases for JScript.

  3. Mike Walsh says:

    To which I can only say that once an American girl came up to my and said.

    "Hi I’m randy"

  4. Louis Parks says:

    "I usually ask them right back what the difference between English and German is…"


  5. bryan says:

    bad response, given that english is a germanic language.

    ‘ Remember, JScript and Javascript are languages independent of the browser object model. ‘

    it’s amazing how many people have a problem with this.

  6. Nick Fitzsimons says:

    "If you are looking for differences between the IE and Netscape browser object models…"

    There are detailed explanations of the differences between the various browser DOM implementations in "Dynamic HTML: The Definitive Reference (2nd edition)", and there’s also some useful discussions of the finer points in "JavaScript and DHTML Cookbook", both by Danny Goodman and published by O’Reilly. HTH.

  7. Eric Lippert says:

    > bad response, given that english

    > is a germanic language.

    Ot’s in keeping with the analogy. Modern German and modern English are both descendents of ancient germanic languages. Javascript and Java are both descendants of the ancient language C.

  8. AndrewSeven says:


    I think there is something implied in the "all the way" that precedes "home".

    Mike ,

    Was she randy or Randy , or both?

    Did you give her a ride or just a ride home?

    I’m thinking that maybe there is a way to apply some Test Driven priciples to PMs, mine want to "install" everything.

    The simplest thing possible.

    The difference between JavaScript and JScript is "ava".

  9. Peter B says:

    >>> write a series of unit tests

    Eric, you talk about unit testing JScript code?? Any tool you could recommend for this?

  10. Eric Lippert says:

    Well, as you might deduce from my earlier article (Thin to my Chagrin), it’s my opinion that if your program is so complicated that it needs lots of unit tests, that maybe JScript isn’t the right language for you.

    Of course, that doesn’t change the fact that people _do_ develop large systems in JScript, and that they should be tested… but unfortunately I’m unaware of any unit test system designed specifically for JScript.

  11. Dave Anderson says:

    "’Remember, JScript and Javascript are languages independent of the browser object model.’

    it’s amazing how many people have a problem with this."

    I am one of them.

    JavaScript is a Netscape product, and Netscape’s own documentation differentiates between client-side and server-side JavaScript on the basis of native objects. Netscape’s client-side JavaScript reference explicitly includes DOM objects, whereas Microsoft keeps DOM and JScript apart.

    If JavaScript is "independent of the browser object model", how is this explained?


  12. Eric Lippert says:

    > If JavaScript is "independent of the browser object model", how is this explained?

    You beat me to it. I was just about to comment that a major reason for this confusion is the Netscape documentation.

    Now, I don’t work for Netscape so this is a conjecture — my guess is that the language was developed at netscape by the browser team, and was initially tightly integrated into the browser. That explains why there are methods in Javascript that assume that the language is embedded in HTML, and it explains why the documentation is tightly integrated with the browser documentation. But like I said, that’s just a guess.

    At Microsoft, we realized that the language would be useful in contexts outside of the browser, and so kept them separate from day one. In fact, the browser team and the script team were in completely separate divisions of the company.

    There are pros and cons of each approach. The pro is obviously that the language is useful in multiple hosts — WSH, ASP, etc — and the con is that things like the memory manager and security system are not as tightly integrated into the browser as one might like.

    When it came time to standardize the language, we made sure that the ECMA specification calls out that the language is independent of the browser object model.

  13. Peter Torr says:

    Gotta love all those HTML-centric methods off the String prototype 🙂

  14. As an irishman, I can tell you that "ride" means "have sex" here. Ergo, what he accidently said was that he had sex with the girl. It’s not offensive, by the way.

  15. That’s also Hiberno-English as opposed to British English.

  16. I think that when people ask for the differences between JavaScript and JScript they basically want a list/table showing the equivelant property in the other (for example, event.srcElement in JScript and event.target in JavaScript). There are a number of these that are sometimes hard to remember, and having all of them in the same place would be one of the most useful references I have found in a long time.

  17. Steve Green says:

    Well, i just read this, and its still relevant today. So well done on writing something that stands up well.

    PS English, is not a germanic language its a combination of many languages, Latin, Greek, French, Norsk et all. In fact that’s probably the reason for its success as a language, its flexibility.

    There is no such thing as American Standard English, or British Standard English, there is just English. But the language accepts and allows barstardisations, such as the Americans and others do to the language.

    Finally I would like to congratulate you on spelling "Behaviour" right.

    PS. Just remembered that my English teacher, once said that the American adjustments to English were probably done to make the spelling easier. Which was probable due to the "give me your poor etc."

    I think I feel the need for a dissertation 😉

  18. Jakob Sternberg says:

    Here's one:

    var myString = "0045"

    var result = parseInt(myString);

    In JScript the result is 37

    in JavaScript the result is 45

    parseInt in JScript has a second parameter radix, which defaults to 10, but when the string starts with an zero, the parameter defaults to 8 (octal base)

Skip to main content