ES6 - What's New?
- Arrow Functions
- Template Literals
Hello `${name}!`
- Destructuring Assignment
const [a, b] = [1, 2]; const { x, y } = { x: 10, y : 20 };
- Let and Const
- Default Parameters
function example (param = defaultValue) { // function body }
- Rest Parameters
function exampleFunction(...args)
- Spread Operator
const newArray = [...oldArray]; const newObj = { ...oldObj };
- Classes
class MyClass { constructor() { } }
- Modules
export const myVariable = 42; import { myVariable } from "./otherModule";
- Promises
const myPromise = new Promise((resolve, reject)) => { // asynchrounous code }