A short summary of JavaScript's main features, including a discussion of the different kinds of JS objects, basic data structures, functions as first class citizens, and code patterns for implementing classes. "In over 20 years programming this is the single best overview of any language ever!"
JavaScript is a dynamic functional object-oriented programming language that can be used for
Enriching a web page by
generating browser-specific HTML content or CSS styling,
inserting dynamic HTML content,
producing special audio-visual effects (animations).
Enriching a web user interface by
implementing advanced user interface components,
validating user input on the client side,
automatically pre-filling certain form fields.
Types and Data Literals JavaScript has three primitive data types: string, number and boolean, and we can test if a variable v holds a value of such a type with the help of typeof(v) as, for instance, in typeof(v)==="number".
There are five basic reference types: Object, Array, Function, Date and RegExp. Arrays, functions, dates and regular expressions are special types of objects, but, conceptually, dates and regular expressions are primitive data values, and happen to be implemented in the form of wrapper objects.
The types of variables, array elements, function parameters and return values are not declared and are normally not checked by JavaScript engines. Type conversion (casting) is performed automatically.