Javascript related notes - wide view

From Helpful
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Related to web development, lower level hosting, and such: (See also the webdev category)

Lower levels


Server stuff:


Higher levels


ECMAscript, Javascript, JScript, etc.

🛈 This section is mostly historical context, you can skip this.
These days, JS and ES are basically synonymous, and you can assume most anything is compliant to at least ES6.


ECMAScript, JavaScript, JScript, and further names all refer to the same language defined by the ECMAscript standard - ECMA-262.


The reason there are multiple names is mostly

name licensing stuff
name marketing stuff
historic variations in different implementations

...the last meant it was useful to refer to name-and-version to describe what nonsense you were working around. Say

Say, JS 1.6 .. 1.9 are non-ECMAScript addition on top of ES3
and JS 1.8.5 was compliant to ES5



Versions (and versions in common browsers)

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


Let's forget ECMAscript before 3 (and JavaScript before 1.5), they were ancient even before hip web standards.


ECMAscript is versioned like:

  • 3 (1999) - seems to be the first serious standard. (≈JavaScript 1.5)
fairly complete wide browser support since 2007ish
  • 4 - was a significant redesign of but never happened due to "oh noes might break many sites" worries.
  • 5 - in part a cleanup of 3
5.1
fairly compete wide browser support since 2015ish[1]
  • 6, later renamed ECMAScript 2015 (a.k.a. 6th Edition, a.k.a. ES6)
adds various new features - including a good part of the 4-that-never-happened (and e.g. types can be used via TypeScript)
fairly complete wide browser support since 2017ish[2]
  • ECMAScript 2016 (a.k.a. 7th Edition)
  • ECMAScript 2017 (a.k.a. 8th Edition)
  • ECMAScript 2018 (a.k.a. 9th Edition)
  • ECMAScript 2019 (a.k.a. 10th Edition)
  • ECMAScript 2020 (a.k.a. 11th Edition)
  • ECMAScript 2021 (a.k.a. 12th Edition)


Browser support is a complex issue, in part due to that faster release cycle, to the point that for much of 201x, the majority of JS development has been transpiling to not get hung up on browser support all the time.

That said, in 202x, we basically have ES6 in all browsers. In this sense, ES6 is the first modern version, those layers can become thinner. But build system habits die hard, plus we will always be ogling features from newer versions.


ESnext, as far as I can tell, is used to mean any of:

  • the version of ES that is currently being written and unfinished
  • the most recent version of ES that this transpiler supports as a target
  • the widest set of ES features this transpiler does: standard stuff, plus the proposals that we tried implementing (which is often a subset of the ones that exist, because living standard)

Note that this means

ESnext means different things at different times
ESnext means different things to different transpilers
ES is just as much a living standard as HTML5 is



See also:

Extensions and variants

So, Javascript was basically a joke that turned serious. There were plenty of things wrong with it, but after a while it became clear it wouldn't go away.

People also didn't agree what was wrong with it. Say, MS thought that its lack of strict typing was a problem, so it created TS, but its adoption rate suggests not everyone quite agreed with that assessment.


Separately, ES/JS was a decent basis to bolt onto some other things.

Also, some platforms define a domain-specific superset of JS that they then transpile to bare JS.

This and further things means there are a lot of flavours now.


TypeScript

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

TypeScript a syntax superset of ES that adds annotated static-like typing.

As an indication how otherwise-similar it is: regular ES is also valid TS.


There is no runtime for typescript, it is transpiled into standard ES.

TS is perhaps the best known ES variant now, being situation-agnostic and not tied to a stack.

...though is associated with recent stacks in that one argument comes "Hey we added a build process to do transpiling/bundling anyway, so why no add what amounts to build time error checking?"


TS lets you find most type-related mistakes at compile time (...only; there are no runtime checks, so you could subvert it if you really wanted to - TS itself introduces casting, including unsafe variants).

TS sees editor integration, so most of that checking can happen as you type, so many errors never even make it to build. (the same editors will often also integrate JSDoc for further assistance, including getting types right. {{comment|(Note that you often can do typing hints to such editors even without TS, using JSDoc).



JSX

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

JSX is basically React's templating language, that mixes HTML into ES, in a way that is usually fairly succinct, and safe (does escaping for you).

It is translated

See also:

CoffeeScript

CoffeeScript is a ES-like thing with a bunch of and syntactic sugar, that transpiles into ES.

Seen e.g. in setups that transpile during builds anyway.


Critically:

  • It looks cleaner to write, but doesn't really solve any problems
so you may decide the extra steps aren't worth it
  • It used to be a superset of ES (3), but now it's more of a subset of ES (6).
there are now few reasons to choose it over ES6 or a more recent transpiling setup, particularly since its devs don't seem to want to integrate ES6 features(verify).


https://en.wikipedia.org/wiki/CoffeeScript

JScript, JScript.NET

Transpiling setups