JavaScript ES6

JavaScript ES6 (ECMAScript 2015)
ES6 introduced modern features to JavaScript, making code cleaner, more readable, and easier to maintain.
let and const
let– Block-scoped variableconst– Block-scoped constant (cannot reassign)
Arrow Functions
Shorter syntax for functions
Lexical
thisbinding
Template Literals
Use backticks
`for stringsSupports interpolation
${variable}and multi-line strings
Default Parameters
Destructuring Assignment
Arrays
Objects
Spread and Rest Operators
Spread (...) – Expand array/object
Rest (...) – Collect remaining items
Enhanced Object Literals
Classes
Modules (Export / Import)
export.js
import.js
Promises (Already Covered)
Other ES6 Features
for...ofloopMapandSetobjectsSymboltypedefault + named exportsin modulesincludes()for strings and arrays
Summary Table
| Feature | Description | Example |
|---|---|---|
| let/const | Block-scoped variables | let x = 10; const y = 5; |
| Arrow Function | Shorter function syntax | const f = a => a*2; |
| Template Literals | Interpolation & multi-line | `Hello ${name}` |
| Destructuring | Extract array/object | let {name} = user; |
| Spread/Rest | Expand/collect | [...arr] / function(...args) |
| Classes | Object-oriented syntax | class Person {} |
| Modules | Import/export code | import {x} from './file.js' |
