JavaScript has evolved significantly over the years, and ECMAScript 2015 (ES6) was one of the most important updates to the language. ES6 introduced a wide range of features designed to make JavaScript code cleaner, more readable, and easier to maintain.
Whether you are building websites, REST APIs, React applications, Node.js projects, or full-stack applications, understanding ES6 features is essential for working with modern JavaScript.
In this guide, we’ll explore 10 must-know ES6 features for JavaScript developers, with practical examples you can start using in your projects today.
1. let and const
Before ES6, JavaScript developers primarily used var to declare variables. ES6 introduced let and const, providing block-level scoping and making variable behavior more predictable.
Use let when a variable needs to be reassigned:
let count = 10;
count = 20;
Use const when the variable should not be reassigned:
const website = "Delight IT Solutions";
Unlike var, variables declared with let and const are scoped to the block in which they are defined.
if (true) {
let message = "Hello";
console.log(message);
}
// message is not accessible here
As a general rule, prefer const when reassignment is not necessary and use let when the value needs to change. MDN’s JavaScript documentation provides more details about let and block scope.
2. Arrow Functions
Arrow functions provide a shorter syntax for writing functions and are particularly useful for callbacks and array operations.
Traditional function:
const numbers = [1, 2, 3];
const doubled = numbers.map(function(number) {
return number * 2;
});
With an arrow function:
const numbers = [1, 2, 3];
const doubled = numbers.map(number => number * 2);
Arrow functions can also contain multiple statements:
const calculateTotal = (price, tax) => {
const total = price + tax;
return total;
};
One important difference is that arrow functions do not have their own this, arguments, or super bindings. This makes them particularly useful when working with callbacks where you want to preserve the surrounding this.
See MDN’s JavaScript functions documentation for additional examples.
3. Template Literals
Template literals make it much easier to create strings containing variables and expressions.
Instead of concatenating strings:
const name = "John";
const message = "Hello " + name + "!";
You can use backticks:
const name = "John";
const message = `Hello ${name}!`;
You can also include expressions:
const price = 100;
const tax = 18;
console.log(`Total price: ${price + tax}`);
Template literals also support multi-line strings:
const message = `
Welcome to our website.
Thanks for visiting.
`;
This feature is especially useful when generating HTML, messages, API responses, or dynamic content. MDN’s template literal documentation covers interpolation and other capabilities.
4. Destructuring
Destructuring allows you to extract values from arrays and objects and assign them directly to variables.
For example:
const user = {
name: "John",
age: 30,
country: "India"
};
const { name, age, country } = user;
console.log(name);
console.log(age);
Without destructuring, you would need to write:
const name = user.name;
const age = user.age;
const country = user.country;
You can also destructure arrays:
const colors = ["red", "green", "blue"];
const [first, second, third] = colors;
console.log(first);
console.log(second);
Destructuring is widely used in modern JavaScript frameworks and libraries, particularly React.
Learn more in MDN’s destructuring documentation.
5. Default Parameters
ES6 allows functions to define default values for parameters.
Instead of manually checking whether a value exists:
function greet(name) {
if (!name) {
name = "Guest";
}
return `Hello ${name}`;
}
You can simply write:
function greet(name = "Guest") {
return `Hello ${name}`;
}
console.log(greet());
console.log(greet("David"));
Default parameters are particularly useful for utility functions, configuration options, and API-related code.
6. Spread and Rest Operators
The spread operator (...) allows you to expand elements from an array or properties from an object.
For example:
const first = [1, 2, 3];
const second = [4, 5, 6];
const numbers = [...first, ...second];
console.log(numbers);
It can also be used to copy and extend objects:
const user = {
name: "John",
age: 30
};
const updatedUser = {
...user,
country: "India"
};
The same ... syntax can be used as a rest parameter to collect multiple function arguments:
function calculateTotal(...prices) {
return prices.reduce((total, price) => total + price, 0);
}
console.log(calculateTotal(10, 20, 30));
Spread and rest operators have become fundamental parts of modern JavaScript development.
7. Classes
ES6 introduced the class syntax, providing a cleaner way to work with object-oriented JavaScript.
class User {
constructor(name, email) {
this.name = name;
this.email = email;
}
getDetails() {
return `${this.name} - ${this.email}`;
}
}
const user = new User("John", "john@example.com");
console.log(user.getDetails());
Classes support constructors, methods, inheritance, and other object-oriented programming concepts.
For example:
class Admin extends User {
deleteUser() {
console.log("User deleted");
}
}
Classes provide a more familiar syntax for developers coming from languages such as Java, C#, or PHP.
8. Promises
Promises provide a structured way to handle asynchronous operations.
Before promises, asynchronous JavaScript often relied heavily on nested callbacks, which could become difficult to maintain.
A simple promise looks like this:
const fetchData = new Promise((resolve, reject) => {
const success = true;
if (success) {
resolve("Data loaded successfully");
} else {
reject("Something went wrong");
}
});
fetchData
.then(result => console.log(result))
.catch(error => console.error(error));
Promises are commonly used when working with APIs, database operations, file operations, and other asynchronous tasks.
They also form the foundation for modern async and await syntax.
9. Modules with import and export
ES6 introduced a standardized module system using import and export.
For example, you can export a function from one file:
// calculator.js
export function add(a, b) {
return a + b;
}
Then import it into another file:
// app.js
import { add } from "./calculator.js";
console.log(add(10, 20));
Modules make large applications easier to organize by allowing functionality to be divided into separate files.
Modern frameworks and environments such as React, Node.js, and many frontend build systems rely heavily on JavaScript modules.
You can explore the details in MDN’s JavaScript modules guide.
10. for…of Loop
ES6 introduced the for...of loop, which provides a simple way to iterate over iterable objects such as arrays, strings, maps, and sets.
Instead of:
const users = ["John", "David", "Sarah"];
for (let i = 0; i < users.length; i++) {
console.log(users[i]);
}
You can write:
const users = ["John", "David", "Sarah"];
for (const user of users) {
console.log(user);
}
This syntax is easier to read and eliminates the need to manually manage array indexes in many situations.
Why ES6 Still Matters
Although ES6 was released in 2015, its features remain fundamental to modern JavaScript development. Developers working with React, Node.js, Vue, Angular, Next.js, and other JavaScript technologies regularly encounter features such as arrow functions, destructuring, modules, promises, classes, and template literals.
Learning these features also makes it easier to understand modern JavaScript code written by other developers.
The goal isn’t simply to use newer syntax. Good JavaScript development is about choosing the syntax and programming technique that makes your code clear, maintainable, and reliable.
Final Thoughts
ES6 transformed JavaScript by introducing features that made the language more powerful and developer-friendly. If you are learning JavaScript or transitioning from older codebases, these 10 features are an excellent foundation.
Start with let and const, arrow functions, template literals, and destructuring. Then move on to spread/rest operators, classes, promises, modules, and modern iteration techniques.
Once these concepts become familiar, you’ll find modern JavaScript frameworks and libraries much easier to understand and work with.
For a comprehensive reference, the MDN JavaScript documentation is an excellent resource for learning the language and exploring individual features.

