javascript

Remove Duplicate Values From an Array in JavaScript Using ES6

We can easily get the distinct values in our JavaScript array by using the spread operator.

const arr = [1,1,4,5,5,37,57,28,67,67];
console.warn(arr); // [1,1,4,5,5,37,57,28,67,67]

//With Spread operator
const newArr = [...(new Set(arr)];
console.warn(newArr); //[1,  4,  5, 37, 57, 28, 67]

The spread operator makes it for us to iterate over an array and return distinct values.

7 JavaScript Shortcuts You Should Start Using

Recent Posts

npm vs. Yarn: Which Package Manager Should You Use in 2025?

When starting a JavaScript project, one of the first decisions you’ll face is: Should I…

3 hours ago

Why Learn Software Development? (And Where to Start)

Software development is one of the most valuable skills you can learn. From building websites…

4 days ago

JavaScript Multidimensional Arrays

In JavaScript, arrays are used to store multiple values in a single variable. While JavaScript…

1 week ago

What is Containerization

Containerization is a lightweight form of virtualization that packages an application and its dependencies into…

2 weeks ago

Microsoft to Replace Remote Desktop App By May 27, 2025

Microsoft is discontinuing support for its Remote Desktop app on Windows, effective May 27th. Users…

3 weeks ago

Common Pitfalls in React Native Development

Now that React Native is your go-to framework for building cross-platform mobile applications efficiently, it's…

3 weeks ago