Var, Let & Const

What changes is the scope in which the variable can be reached, and if it is constant (cannot be reassigned.

Where to use?

Use only let or const whenever possible. Initialize it as a const and if a reassignment is needed further on, change it to a let.


Template Literals

This:

var name = 'Joe';
const welcome = 'Welcome ' + name + '!'; // Concatenation

Is now This:

const name = 'Joe';
const welcome = `Welcome ${name}!`; // Interpolation

Syntax

`` // Any String
${} // Any JS Code to interpolate
; // Break line
const foo = `Any string text; ${1 + 1}; ${2 + 2}`;

Arrow Functions

This:

function welcome(name) {
	var message = 'Welcome ' + name + '!';
	return message;
}

Is now This: