Tag: es6

Variable Declarations - Let and Const - ES6

Previously variables were declared using the var shorthand. var declares a varaible statement and is declared before JS code is executed. The scope of a variable is contained...

Template Literals - ES6

Template Literals (pre ES2015 String Literals) allow for strings to be created with extended syntacticaly components and functionality. Template Literals are strings enclosed with the back quote or back tick...

Import and Export - ES6

The import statement is used to bring in functions/classes/variables from other files that have been exported. Import statements must be declared at the top of the file. Import types...

Enhanced Object Literals - ES6

This allows for syntactically shorter code when declaring objects. This affects Property Value declarations, Object Methods and Dynamic Propeties. How is this achieved? Lets take the following code prior to...

Default, Rest and Spread - ES6

Parameters have been upgraded with the addition of defaults, rest and spreads. Default Previously we had to load functions as follows: function test(one, two) { two...

Arrow Functions

Arrow functions What are arrow functions? On a basic level, arrow functions are a shorthand version of anonymous functions. Below is an exmple of the same function written...

Classes - ES6

What are classes? A class is essentially a template/blueprint that creates an object. JS classes is nothing new for the world of javascript, it is rather a cleaner syntax...

Promises - ES6

A promise represents a single asynchronous operation. ES2015 provides a pattern/method to declare an operation that hasn’t been completed but is expected to be completed. The simplest way to demonstate...

Why code in ES2015 if the browser doesn't support it?

TLDR: Compilers. A bit of history Lets start with a bit of history. In the late 90’s, with the fall of Netscape Navigator, Microsoft’s Internet Explorer dominated the browser...