ES6 Intro in JavaScript
ECMAScript 6 Introduction
ECMAScript (ES) is a scripting language specification created to standardize JavaScript. It adds significant new syntax for writing complex applications, including classes and modules, iterators and for/of loops, generators, arrow functions, binary data, typed arrays, collections (maps, sets, and weak maps), promises, numbers, and math enhancements, reflection, and proxies. So, ES6 is a superset of JavaScript.
Ways to declare variables in ES6 are:-
var
It defines variables globally
let
It allows the creation of variables with block scope
const
it has the same scope as let but it is immutable
What are Template literals?
Template literals are a way to output variables in the string. Template literals are enclosed by the backtick (` `) character instead of double or single quotes.
${expression} is a placeholder and it includes any expression which will get evaluated and inserted into the template literal.
Syntax:-
let a = 20;
document.write(`The age is ${a}`);