New DOCX Document
New DOCX Document
js
Arrow Functions:
Arrow functions provide a shorter syntax for writing functions.
They also lexically bind the this keyword, avoiding issues with
traditional function scope.
js
const add = (a, b) => a + b;
Template Literals:
Template literals use backticks (`) to create strings and allow
embedding expressions inside strings using ${}.
js
Destructuring Assignment:
Destructuring makes it easy to extract values from arrays or
properties from objects into individual variables.
js
js
Classes:
ES6 introduced the class syntax as a cleaner way to create
objects and handle inheritance, though it is syntactical sugar
over JavaScript’s prototype-based inheritance.
js
class Person {
constructor(name) {
this.name = name;
}
greet() {
console.log(`Hi, I am ${this.name}`);
}
}
Modules:
ES6 modules allow you to import and export pieces of code
between different files, promoting better code organization.
js
Promises:
Promises provide a cleaner way to handle asynchronous
operations compared to traditional callbacks, improving code
readability and error handling.