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?

Vaitheeswaran
  • 87
  • 1
  • 2
  • 13
huy
  • 4,782
  • 6
  • 36
  • 42

11 Answers11

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.

googletorp
  • 33,075
  • 15
  • 67
  • 82
  • I see, so different browsers have its own implementation according to the ECMA-262 standard that Michael mentioned above? – huy Oct 22 '09 at 10:08
  • 3
    @huy: yes - with varying levels of support for/varying interpretations of that standard, sadly... – Andrzej Doyle Oct 22 '09 at 10:25
  • 1
    -1, There *is* an official Javascript standard: it's called ECMAscript and there's an official body behind it: http://en.wikipedia.org/wiki/Ecma_International – hasen Oct 22 '09 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. –  Jul 12 '10 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 '11 at 17:09
  • Just because browsers choose not to follow the standard does not mean an official reference would not be helpful. It would make it really clear when a browser decides to deviate from it, and would pressure them to consider such deviances as bugs that programmers will be very unhappy about. It would also provide developers with a starting point reference for when they want to make cross platform code so to speak. – still_dreaming_1 Oct 24 '16 at 20:42
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

Victor
  • 9,210
  • 3
  • 26
  • 39
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."

DavidRR
  • 18,291
  • 25
  • 109
  • 191
Espo
  • 41,399
  • 21
  • 132
  • 159
  • 8
    IE doesn't have a JavaScript engine - it implements JScript instead (which is largely compatible). http://msdn.microsoft.com/en-us/library/yek4tbz0%28VS.85%29.aspx looks like the official reference for that. – Quentin Oct 22 '09 at 10:07
  • 3
    Hmm... https://developer.mozilla/ is very helpful, but I wouldn't call it "official". The ECMAScript Language Specification is closer to "official". – Steve Harrison Oct 22 '09 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 '09 at 10:50
  • +1 for the ECMAScript standard. – Jason S Nov 14 '09 at 00:11
  • @Quentin - Interesting that the title of the [MSDN link](http://msdn.microsoft.com/en-us/library/yek4tbz0%28VS.85%29.aspx) you reference is now **"JavaScript Reference"**. However, the MSDN article ["JScript (ECMAScript3)"](http://msdn.microsoft.com/en-us/library/hbxc2t98%28VS.85%29.aspx) 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 '14 at 15:30
  • @DavidRR — Microsoft have come a long way with standards support in the last half decade. – Quentin Nov 12 '14 at 15:43
  • To add to that answer, you can always find links to the current and past editions of the "ECMAScript Language Specification" on this page: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Language_Resources. – Chafic Mar 10 '18 at 13:47
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.

Community
  • 1
  • 1
SandroMarques
  • 6,070
  • 1
  • 41
  • 46
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.

user195021
  • 71
  • 1
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.

Michael Aaron Safyan
  • 93,612
  • 16
  • 138
  • 200
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).

Eli Grey
  • 35,104
  • 14
  • 75
  • 93
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.

bobince
  • 528,062
  • 107
  • 651
  • 834
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.

Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270
  • Actually, the people responsible for JavaScript would be Netscape (now Mozilla), and they do make good documentation: the MDC. I agree with you about the ECMAScript standard being poor if you're trying to learn JavaScript, though. – Pauan Aug 13 '11 at 12:47
  • @Pauan: are Mozilla responsible for JavaScript? Isn’t it more like HTML and CSS, where browser manufacturers in general are collectively responsible for it? Or are Mozilla in reality the only organisation pushing the language (as opposed to DOM interfaces like those found in HTML5) forward? (I only ask as I’m not familiar with the situation; I have enough trouble getting my JavaScript code to work at all without worrying my pretty little head with new stuff in the core language.) – Paul D. Waite Aug 13 '11 at 13:42
  • 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 '11 at 16:53
  • 1
    In addition, notice this link: http://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 '11 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 '11 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 '11 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 '11 at 17:01
  • @Pauan: heh! Quite possibly, it’s most deserving of upvotes. – Paul D. Waite Aug 22 '11 at 07:33
-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.

Ben
  • 1,531
  • 1
  • 11
  • 9