98

I tried to search for a JavaScript reference, but there's none available. The best two suggested sources are MDN (Mozilla Developer Network) and ECMA (https://262.ecma-international.org/12.0/)

Why?

9
  • 57
    Avoid w3schools; its JS material tends to be extremely poor, IMHO.
    – NickFitz
    Oct 22, 2009 at 10:53
  • 1
    Sorry I meant MDC; developer.mozilla.org/en/About_JavaScript
    – huy
    Oct 25, 2009 at 6:13
  • 10
    This is kind of a random comment, but personally I think all browsers should scrap all the Javascript/Jscript bastardisations and implement jQuery natively. :) Nov 14, 2009 at 0:03
  • 14
    jQuery wallpapers over the DOM, but doesn't actually replace JavaScript.
    – Rob
    Nov 14, 2009 at 0:04
  • 2
    @huy MDN , not MDC or MDE
    – maan81
    Apr 19, 2014 at 15:27

11 Answers 11

70

It's not like there is an official JavaScript release. All the browsers have made their own JavaScript engine - some are using the same though. But especially Internet Explorer has its own version that doesn't support a lot of what the other browsers support, making it very difficult to make a general JavaScript reference.

Edit:
While I know there is an official ECMA standard and development team, my point is that it doesn't really matter as long as browsers (Internet Explorer) doesn't live up to it. At the end of the day, clients want JavaScript to work for Internet Explorer too. They won't care about the ECMA standards, they just want it to work. This is where JavaScript libraries come into the picture, but that's another story.

It's the same issues with HTML and CSS, we can't use these tools for active development until:

  • All browsers support them.
  • We supply the browsers with code to make them support it.
  • It's okay it doesn't work in all browsers.

Edit2:
Internet Explorer is getting close to the grave with the new browser project from Microsoft: Edge. This, however, doesn't really change the overall picture. We still have a lot if different browsers we need to support. Developers are constantly trying to push the boundaries of what's possible. This means that we often have this issue, some browser version we want to support doesn't support some feature of the standard (which usually is a bit fluid), which means we need to make some workaround or use frameworks that implement the missing built in features.

6
  • I see, so different browsers have its own implementation according to the ECMA-262 standard that Michael mentioned above?
    – huy
    Oct 22, 2009 at 10:08
  • 3
    @huy: yes - with varying levels of support for/varying interpretations of that standard, sadly... Oct 22, 2009 at 10:25
  • 1
    -1, There is an official Javascript standard: it's called ECMAscript and there's an official body behind it: en.wikipedia.org/wiki/Ecma_International
    – hasen
    Oct 22, 2009 at 13:19
  • I'm not sure why you singled out Internet Explorer as being any worse at supporting the ECMA "standard" as any other browser.
    – user122299
    Jul 12, 2010 at 22:32
  • 5
    @ראובן: Because it is/was. For a long time IE not only had many severe bugs that other browsers did not, but it also was missing important features that other browsers had. IE8 and 9 have caught up a lot, though, so the situation is changing. But for many years IE was horrid, while the other browsers had good ECMAScript support. In addition, ECMAScript is a standard. I'm not sure why you put it in quotation marks.
    – Pauan
    Aug 21, 2011 at 17:09
27

You can try with the official ECMAscript site,

http://www.ecmascript.org/

but the useful thing is actually the implementation of each browser.

I like this cheatsheet from Danny Goodman's JavaScript Bible a lot:

http://media.wiley.com/product_ancillary/12/04705269/DOWNLOAD/9780470526910_Appendix_A.pdf

3
  • That cheat sheet is dead. Might I suggest caniuse.com?
    – Grinn
    Jul 9, 2013 at 18:02
  • Thanks, i linked to the new link and explained a bit what it was. Thanks for the heads up!
    – Victor
    Jul 14, 2013 at 21:19
  • Nice, I'll check that out.
    – Grinn
    Jul 15, 2013 at 14:13
23

I would say this one is the "official": https://developer.mozilla.org/en/JavaScript

You also have the ECMAScript Language Specification, 5.1 Edition (or as a PDF, the definitive specification).

And from Microsoft: JavaScript Language Reference: "This documentation explains the Microsoft implementation of JavaScript, which is compliant with the ECMAScript 5th Edition language specification. It also provides additional features that are not included in the Ecma Standards."

7
  • 8
    IE doesn't have a JavaScript engine - it implements JScript instead (which is largely compatible). msdn.microsoft.com/en-us/library/yek4tbz0%28VS.85%29.aspx looks like the official reference for that.
    – Quentin
    Oct 22, 2009 at 10:07
  • 3
    Hmm... developer.mozilla is very helpful, but I wouldn't call it "official". The ECMAScript Language Specification is closer to "official". Oct 22, 2009 at 10:14
  • 4
    The ECMAScript Language Specification is the official reference for ECMAScript. JavaScript is a superset of ECMAScript, was created by Netscape, and Mozilla inherited MDC from Netscape (although the name has changed since then)
    – Quentin
    Oct 22, 2009 at 10:50
  • +1 for the ECMAScript standard.
    – Jason S
    Nov 14, 2009 at 0:11
  • @Quentin - Interesting that the title of the MSDN link you reference is now "JavaScript Reference". However, the MSDN article "JScript (ECMAScript3)" states: "JScript is the Microsoft implementation of the ECMA 262 language specification (ECMAScript Edition 3). With only a few minor exceptions (to maintain backwards compatibility), JScript is a full implementation of the ECMA standard.".
    – DavidRR
    Nov 12, 2014 at 15:30
10

If you're using ECMAScript for the web (which 99.9% of people are), then beyond the basics syntactics of the language (covered in the ECMA-262 spec mentioned above), what you're probably looking for is a DOM reference - which is the ECMAScript API that's used to interact with web documents.

I'm very surprised noone has mentioned the DOM api sofar. Current W3C DOM standard is here: http://www.w3.org/TR/DOM-Level-2-Core/

(btw, as for the naming confusion - ECMAScript is the name of the official standard, and "Javascript" and "JScript" are Netscape and Microsoft's proprietary "forks")

6

Wikipedia's quotation:

Beginnings at Netscape

In November 1996, Netscape submitted JavaScript to Ecma International ...

JavaScript is officially managed by Mozilla Foundation ...

So, in my opinion, the ECMA is the standard and Mozilla is the official one.

4

It is very difficult to have an "official" reference as long as there are implementations (in all browsers) and there is a specification (ECMAScript) but no conformance tests of implementations against the specifications.

Now though, we have the EMCAScript 5 conformance suite at http://es5conform.codeplex.com/ - and there seems some consensus that ECMAScript implementations will come closer together, making ECMAScript more likely to be the official reference for the language.

3

There is an official reference, it just isn't in a very convenient format. It is the ECMA-262 specification. It is a single, very large PDF document, instead of a searchable set of HTML pages.

3

Any revisions of JavaScript pages on MDC by a member of the Mozilla Documentation team (like Eric Shepherd) is official. JavaScript is officially maintained by Mozilla so only documentation by Mozilla is official. The only engines that support JavaScript are currently made by Mozilla and every other engine implements ECMAScript. JavaScript and ECMAScript have quite a few differences (for example, the awesome let statement).

2

I find the old-school Netscape 4 JavaScript docs very useful for this purpose. Although they're obviously totally outdated, and some of the DOM features in them like Layers are long gone, for the language basics they're really solid.

That's because before the days of IE supremacy and ECMA standardisation, Netscape's JavaScript was the definitive JavaScript. Other browsers pretty much had to implement exactly what you see in those old docs.

They're also much easier to read than the ECMA-262 document, which even by the standards of standards documents is an absolute horror.

1

By “official”, I think you mean “written by the people responsible for JavaScript”.

Just speculating here really, but the people responsible for JavaScript (the ECMA) don’t directly make any money out of it, and probably don’t have any particular skills in writing reference documentation. So they have neither the incentive nor the ability to write a good reference.

Personally, I like JavaScript: the Definitive Guide from O’Reilly. There’s a sixth edition coming out in November.

8
  • 2
    Yes, they are. Sun owns the trademark for JavaScript, but licensed it to Netscape. Oracle bought Sun, so now Oracle owns the trademark (they still license it to Mozilla). HTML and CSS are defined by the W3C, so that's a different matter. The JS engine in Firefox contains many proprietary (and awesome) features that are not found in any other browser. The creator of JavaScript (Brendan Eich) is on the official ECMAScript committee, and also works for Mozilla.
    – Pauan
    Aug 21, 2011 at 16:53
  • 1
    In addition, notice this link: en.wikipedia.org/wiki/ECMAScript#Dialects Firefox has what is known as "JavaScript 1.8.5" which as already mentioned contains many advanced features not found in other browsers like object/array destructuring/comprehensions, generators/iterators, let blocks/statements, etc. Also note the 2nd footnote in that link, which says "Mozilla manages the official version of JavaScript. Most non-Mozilla implementations claiming JavaScript "compliance" do not actually support most JavaScript extensions; rather, they target ECMA-262, edition 3."
    – Pauan
    Aug 21, 2011 at 16:55
  • 1
    I'll note that ECMAScript is different from JavaScript. ECMAScript is a standard defined by Ecma. Browsers are usually pretty good about supporting the ECMAScript standard, and when most people say "JavaScript" what they really mean is ECMAScript. It's unfortunate that the situation and terminology is so confusing, but there it is. So, for the most part, the informal definition of JavaScript is "whatever the browsers do", but officially, Mozilla is indeed responsible for it.
    – Pauan
    Aug 21, 2011 at 16:58
  • 1
    What this means is that any question that asks for an "official JavaScript reference" is far too vague to accurately answer. You have the official ECMAScript standard, the actual implementations of JavaScript in the browsers, the MDC (which covers the official JavaScript implementation in Firefox), and then of course the very popular unofficial documentation like w3schools. All are useful, so there's not really any "single correct" reference like there is for, say, Python.
    – Pauan
    Aug 21, 2011 at 17:00
  • 2
    (perhaps I should have posted this as an actual answer, rather than a series of comments... oh well)
    – Pauan
    Aug 21, 2011 at 17:01
-1

I really like Daniel Krook's apidoc, even though it could use some explanations and examples. I would really like to see a krook w3school mashup.

Not the answer you're looking for? Browse other questions tagged or ask your own question.