JavaScript ES7

JavaScript Tutorial

JavaScript ES7+ Features (ES2016+)

After ES6, JavaScript ES7 introduced several new features every year. ES7 and above focus on making code simpler, cleaner, and more powerful.


 Exponentiation Operator (**) – ES7

  • Replaces Math.pow() for calculating powers.

Equivalent:


 Array.prototype.includes() – ES7

  • Checks if an array contains a value (returns true/false).

Works for strings too:


 Object.values() and Object.entries() – ES8

  • Object.values(obj) – Returns array of values

  • Object.entries(obj) – Returns array of [key, value] pairs


 


 String Padding – ES8

  • padStart() – Adds characters at the start

  • padEnd() – Adds characters at the end


 Trailing Commas in Functions / Arrays / Objects – ES8


 


 Async/Await – ES8

  • Already covered in detail.

  • Makes Promise-based code easier to read.


 Object Spread / Rest Properties – ES9 (2018)

  • Spread (...) – Copy or merge objects

  • Rest (...) – Extract remaining properties


 


 Optional Chaining (?.) – ES11 (2020)

  • Access nested object properties safely without errors.


 Nullish Coalescing (??) – ES11 (2020)

  • Returns the right-hand value only if left-hand is null or undefined.


 


 BigInt – ES2020

  • Store very large integers beyond Number.MAX_SAFE_INTEGER.


 Dynamic Imports – ES2020

  • Load modules on-demand using import().


 Logical Assignment Operators – ES2021


 


Summary Table

FeatureIntroducedExample
ExponentiationES72 ** 3
Array.includes()ES7[1,2].includes(2)
Object.values() / entries()ES8Object.values(obj)
String paddingES8"5".padStart(3, "0")
Async/AwaitES8await fetch()
Object spread/restES9{ ...obj }
Optional chainingES11user?.address?.city
Nullish coalescingES11x ?? 10
BigIntES2020123n
Dynamic importES2020import("./module.js")
Logical assignmentES2021`a

You may also like...