- ES6 is the latest version of the ECMAScript standard. This standard is a scripting-language specification that JavaScript (Chrome, etc.), JScript (IE) and ActionScript (Adobe) adhere to for client side development. The first edition of standards was released in 1997 and the last major update prior to ES6 was in 2009.
- Transpilaton is the process of taking code from one language or standard and transforming it into another similar language or standard. This relates because ES6 is not yet fully supported, so the client side javascript must be transpiled into ES5 via Babel or Traceur.
Looking at the ES6 Features link below, discuss one update from ES5
and if it seems useful/superfluous.
- An interesting update in ES6 is the
let
andconst
features.let
is the newvar
and is used to declare a block scope local variable, whereconst
is used in single assignment. The variable must be assigned (vialet
) prior to using it as aconst
. This feature seems useful when containing variable scope is necessary inside a function or variable. The addition was influenced by Firefox.
Example:
function foo(){ for(let i = 0; i< 10; i++){ // i is visible } // i is not visible }
👍
FYI when you have a codeblock in markdown you can wrap it in three backticks followed by the language above the code ````js`, and three backticks below:
Hard to show in markdown without markdown automatically converting it.. but this is what it'll look like