Javascript related notes

From Helpful
Jump to: navigation, search
Related to web development, hosting, and such: (See also the webdev category)
jQuery: Introduction, some basics, examples · plugin notes · unsorted

Server stuff:

Dynamic server stuff:

ECMAscript, Javascript, JScript, TypeScript

tl;dr:

  • Javascript and JScript are slightly different implementations of the ECMAscript standard.
Each implementation has its own versioning, unrelated to ECMAscript versioning.
  • Most people use 'Javascript' to refer to all of these / "some version or variant of ECMAScript"
  • TypeScript is a syntax that adds explicit typing on ECMAscript, which is then converted to standard ECMAscript (basically adds typing checks) (verify)


The most standard form is the ECMA-262 standard, describing ECMAscript.

You could say that ECMAscript is the language, and Gecko's JavaScript, Microsoft's JScript, and various others are implementations of it. (Various of these names are also trademarked)


Since browsers have long been the most prominent users of javascript, each has their own non-ECMA additions and deviations. Including things you may find obvious, such as DOM access.

Things are better these days, but programmers may still want a library to make their life saner.


There are also some formalized extensions, for example:

  • TypeScript, a superset that adds annotated static typing
can transcompile to JS. Seems intended as a "strongly typed on the server side, can also be served to browsers" thing
plain JS is also valid typescript
  • JScript.NET, a compiled variant of JScript (and will tend to use .NET rather than COM/ActiveX)
  • CoffeeScript, JS-like with a bunch of syntactic sugar. Transcompiles to JS source. [1]


Versions (and versions in common browsers)

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)


Let's forget ECMAscript before 3 and Javascript before 1.5, they were ancient even before hip-web standards. You can assume that (very-almost-) everyone has at least (and at most) that level of support now.


ECMAscript is versioned like:

  • 3 (1999) - seems to be the first serious version. (≈JavaScript 1.5)
  • 4 - was a significant redesign of but never happened due to "oh noes will break many sites" worries.
  • 5 - in part a cleanup of 3
  • 5.1 -
  • 6 - adds various new features - including a good part of the 4-that-never-happened (and e.g. types can be used via TypeScript)
  • 7 - in progress

Browsers have at the very least ES3 support, and most modern implementations (≥ 2015, browser or not) are typically at 5, often 5.1(verify).



See also:



Differences and deviations

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)

Some of the interesting ones:

Syntax

Trailing commas

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Trailing_commas

Indexing a string

DOM

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)