Home » Questions » javascript

javascript

JavaScript

JavaScript is a dynamic, object-oriented, prototype-based, weakly typed language commonly used for scripting in web browsers.

It runs on nearly every OS, and a JavaScript engine is included in almost every mainstream web browser. It was originally called LiveScript, and was developed by Netscape, but they named it JavaScript due to Netscape’s friendship with Sun Microsystems.

Standalone JavaScript engines or interpreters are available as well, including:

  • Mozilla offers Rhino, an implementation of JavaScript built in Java.
  • Google’s JavaScript interpreter, V8, is used in Google Chrome, (a platform which enables server-side applications to be written in JavaScript) and other projects.
  • Windows includes a JavaScript variant in its Windows Script Host .
  • WebKit (excluding Chromium) implements the JavaScriptCore engine .

The Mozilla Developer Network offers good documentation on JavaScript.

JavaScript is typically used to manipulate the Document Object Model (DOM) and Cascading Style Sheets (CSS) within the browser, offering user interface scripting, animation, automation, client-side validation, and much more.

Nomenclature

People often use the term JavaScript informally. The language and the term originated from Netscape. ECMAScript, JavaScript, and JScript are terms that are easy to confuse.

ECMAScript was developed as a standardization of Netscape’s JavaScript and Microsoft’s independently-developed JScript. The canonical reference is The ECMA-262 Language Specification. While JavaScript and JScript aim to be compatible with ECMAScript, they also provide additional features (and other deviations) not described in the ECMA specifications. Other implementations of ECMAScript also exist.

The differences today for those who use JavaScript are negligible; people do not distinguish the JavaScript and JScript variations from ECMAScript.


When asking a JavaScript question, you should:

  1. Isolate the problematic code and reproduce it in an online environment such as jsFiddle or JS Bin.
  2. If a library or framework is used, then tag the question with the appropriate tags: for jQuery, for Prototype, for MooTools, and so on. However, if a framework is not used/necessary, do not include these tags.
  3. Mention which browser the code is having problems on, and what error messages, if any, were thrown by the browser. If the question is browser-specific, use tags , , , etc.
  4. Only tag the question as or if you are asking about an issue that concerns the combination of one of those with JavaScript and could only be answered with information specifically regarding either of those subjects.

Learning JavaScript

Wisdom from the Stack

Useful links

Free JavaScript Programming Books


Frequently Asked Questions

Find some answers to some of the more frequently asked questions about JavaScript and related technology below.


Q: I have this JSON structure, how can I access property x.y.z?
A: Every structure is different but how to access them is the same. First you have to parse the JSON into a JavaScript object or array. Then access the correct properties or array indexes. To learn about object and arrays, have a look at the MDN JavaScript guide.
It is advisable to inspect the structure step by step to figure out which property or index you have to access, i.e. console.dir(x), console.dir(x.y), console.dir(x.y[2]) etc.

Q: How can I pass a PHP array to JavaScript?
A: Pass a PHP array to a JavaScript function

Q: How to set up proper inheritance?
A: Objects don't inherit prototyped functions

Q: How do JavaScript closures work?
A: How do JavaScript closures work?

Q: setTimeout() inside for always using last value?
A: setTimeout in a for-loop and pass i as value

NOTE: The content of this tag was originally posted at StackOverflow.com

2 votes
20k views
I would like to know if anyone knows of an online service where we paste the code and it generate...
  • Betty asked 15 years ago
  • last active 15 years ago
Showing 1 result