As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've been searching around online for a while now and I can't seem to find any particularly impressive function references for JavaScript.
Of course, QuirksMode and w3schools have good information, but they're not as complete for JavaScript as the flash component reference and jQuery API are for flash and jQuery.
So does anyone know of a good JavaScript reference with some or all of the following qualities?
Documentation on most functions/objects/packages/prototypes
Browser compatibility
examples of usage
clean layout
community comments/examples
library APIs
Yes, the Mozilla Developer Center is a much better area, it lacks the community integration, but the descriptions and organization are much better (and more accurate) than w3schools.
Mozilla has very complete docs:
https://developer.mozilla.org/en/JavaScript/Reference
DevGuru has a very complete list also
http://www.devguru.com/technologies/ecmascript/quickref/javascript_index.html
in addition if you want to see all the quirky differences that Microsoft implemented then MSDN provides a fairly complete (but not frequently updated or corrected) set of docs here:
http://msdn.microsoft.com/en-us/library/ms533054%28v=VS.85%29.aspx
For the built-in objects, the reference is in the ECMAScript spec:
http://www.ecma-international.org/publications/standards/Ecma-262.htm
For the host objects, use MDC and MSDN:
https://developer.mozilla.org/en/gecko_dom_reference
http://msdn.microsoft.com/en-us/library/ms533050(VS.85).aspx
Also, there is the Webkit DOM Reference (but it seems somewhat sloppy):
http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/WebKitDOMRef/index.html
Then again there are the web-standards defined by W3C. You can use my W3 Viewer to browse them:
http://www.w3viewer.com
(The standards of interest are in the "JavaScript" and "DOM" categories)
In my opinion, nothing beats the reference of the book JavaScript: The Definitive Guide.
The JavaScript Kit have a pretty good one: http://www.javascriptkit.com/jsref/
A little harder to digest, but perhaps more complete (but only including the core, not web-specific stuff like window or document) is the ECMAScript specification: http://www.ecmascript.org/docs.php
And then there are the Mozilla and MSDN references, for browser specific stuff. https://developer.mozilla.org/en/JavaScript/Reference, http://msdn.microsoft.com/en-us/library/d1et7k7c(VS.94).aspx
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Javascript seems to become popular as an implementation language for other programming languages.
The article
Lightweight compilation of (C)LP to JavaScript. ICLP 2012
drew my attention on this.
There are a lot of proof-of-concept prototypes for Prolog systems written in Javascript around on the Web.
What are current, actively maintained, preferably ISO conforming Prolog systems written in Javascript?
The only Prolog in JavaScript I know is YieldProlog, but I haven't tried it extensively, just the code available in QueryEditor.
I was hoping than using the yield construct it was lightweight (I used extensively such construct in C#, and I found it - paired to lambda - rather powerful).
But when I inspected (summarily) the source, I found it really complex, despite the assumptions.
edit
I've found recently these contributions, that seem really interesting:
proscript and proscript2.
edit
a new implementation available:
Tau Prolog, brought to my attention from Jan on SWI mailing list
edit
Something new, hhprolog, a pure Prolog engine, based on code and documentation provided by Paul Tarau, ported by me to Javascript. So, available in both browsers and NodeJS.
The project is still preliminary, mostly needed is to bootstrap to interpreter: right now (pre)compiling Prolog to the (novel) virtual machine must be accomplished with SWI-Prolog installed, properly configured (JPL needed).
To implement such bootstrapping, I would probably need to implement negation, to reuse Paul' interface, or - better - attempt to implement something staying in the pure paradigm. In particular, only unbounded integer arithmetic (again by Paul Tarau, there is some Python code available - I will try lazily to port to Javascript).
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Is there a complete and a most updated and downloadable JavaScript Language Reference Manual!?
The closest thing to an official documentation is the ECMA specification. Implementors of JavaScript follow this specification.
However, the most widely used and penetrable (reading the spec for quick reference can be daunting) documentation is JavaScript at Mozilla Documentation Network. It has a lot of information that is handy for using JavaScript in the browser too.
JavaScript is not one thing, with a single possible manual. There are different things that people put together under the JavaScript name:
The ECMAScript standard
The different implementations of a JavaScript engine used by browsers, which extend the ECMA standard with new APIs
Various APIs defined elsewhere, mostly at W3C, such as DOM, HTML5 APIs, other parts that people put under the HTML5 umbrella
Various serverside engines, like Node.js, which add their own APIs, plus all of the libraries that work with these engines
Tons of libraries and frameworks that are built on top of the base JavaScript support that browsers offer, like React, Angular, jQuery...
The best reference for what is normally considered JavaScript is indeed the Mozilla Developer Network.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I read somewhere that using prototype to extend native objects (String, Number, Array, etc.) was a bad idea. Is this true? Why or why not?
I don't think it's bad. If you have a look at Ruby on Rails, very many native objects are extended with custom functionality and it's a very good framework.
What would be bad is if you change existing methods on native objects. this could cause unforseen consequences.
There's a great discussion about this in this video from JSConf 2011 by Andrew Dupont. http://blip.tv/jsconf/jsconf2011-andrew-dupont-everything-is-permitted-extending-built-ins-5211542
Basically the points are:
Don't extend Object.prototype
Some people might like to extend things, some people don't
You need to know what you're doing
Don't use two libraries that extend things, because it can be bad
Extending prototypes to add standard functionality is almost always ok.
I would stay clear of extending/modifying behavior of native objects.
It at least makes sense when developing in a team environment.
Simply because, months later, another developer writing another independent piece of code isn't immediately going to recognize the changed behavior unless documented somewhere and made aware of it prior to starting his task.
Instead, I suggest encapsulating/"namespace"-ing all such functionality such that somebody may chose to or not to use the modified functions.
Also, native objects and their methods are thoroughly tested for wide-ranging cases. So you you'd have to be completely sure of what you're doing before modifying native functionality.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I'm wondering if such a library exists, where the library contains only a collection of common utility functions such as trim, indexOf (for arrays), map, each, typeOf and so on...
I'm aware that jQuery provides some of the functions I listed above, but I'm looking for something that is designed purely for this (I really don't need jQuery on the server-side running node.js for instance, nor do I want to depend on it if I'm writing a non-jQuery-related JavaScript library). I've recently begun collecting an assortment of these functions for future copy/pasting, but my guess is that there are many others that I won't even know to look for, or think of using, unless someone presents them to me.
I'm fond of underscore.js; it doesn't provide string utilities such as trim; it's focused on object-oriented and functional utilities, including all of the other things you mention. Another nice thing about it is that it doesn't reference the DOM at all, so it's useful for javascript programming that isn't web-based or DOM related.
The functions you mention are all standard in ECMAScript 5. And this library implements them in such a way that you can use them in older browsers/JavaScript versions as well, in a way that will be compatible when your environment catches up with the standard:
https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js
Boiler.js is an up and coming utility library that offers many useful JavaScript utilities and is a direct competitor with Underscore.js.
jQuery provides all of those and many more, you would be better off just using it.
jQuery can sit side-by-side with other frameworks, so can be independent if another framework is present.
See: jQuery Utilities Documentation
Javascript itself has many of these functions built into the basic types. Before building your own, perhaps a copy of JavaScript: The Definitive Guide, focusing on the API reference in the back, would do you some solid good.
After that investigate frameworks, or at least being looking into how you can create your own framework for your functions (as opposed to copying and pasting). Here the module pattern would be helpful to you.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am looking for a reference card for JavaScript - for example a summary of syntax and methods parameters. Google gives me lots of choices. What is a good one?
Actually, the one I use is the first hit on a Google search - Added Bytes Cheat Sheet .
Danny Goodman's JavaScript and Browser Objects Quick Reference is quite useful.
Devguru is a very good one that I use when in doubt.
If you don't mind spending a bit of money The VisiBone products are well worth the outlay!
VisiBone Javascript
For basic stuff I recommend W3Schools. It's not great but it's an ok beginning. For advanced stuff I recommend the Mozilla documentation. For on the fly prototyping I recommend a JavaScript Shell which can allow you to test what methods are available by doing something like props(object) which shows what properties (fields, methods) an object has.
Personally, I like the O'Reilly pocket reference books for stuff like this, they are inexpensive and come in handy here and there.
But, if you are looking for something online, I usually find a lot of good basic javascript (and HTML/CSS/etc..) stuff on w3schools.
You may find a lot of JavaScript cheat sheets at TechPosters website.
This is new, but very good: Encycode JavaScript Cheat Sheet