JavaScript ES6

JavaScript Tutorial

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 variable

  • const – Block-scoped constant (cannot reassign)


 


 Arrow Functions

  • Shorter syntax for functions

  • Lexical this binding


 


 Template Literals

  • Use backticks ` for strings

  • Supports 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...of loop

  • Map and Set objects

  • Symbol type

  • default + named exports in modules

  • includes() for strings and arrays


Summary Table

FeatureDescriptionExample
let/constBlock-scoped variableslet x = 10; const y = 5;
Arrow FunctionShorter function syntaxconst f = a => a*2;
Template LiteralsInterpolation & multi-line`Hello ${name}`
DestructuringExtract array/objectlet {name} = user;
Spread/RestExpand/collect[...arr] / function(...args)
ClassesObject-oriented syntaxclass Person {}
ModulesImport/export codeimport {x} from './file.js'

You may also like...