# JavaScript Remove Duplicates from Array

Today I want to share with you guys the easiest way to remove duplicates in an array with `JavaScript`.

We are going to be using the [`Set`](https://daily-dev-tips.com/posts/javascript-es6-sets/) method for this.

> BTW: I have a free Giveaway on Twitter! [🚨 Free Giveaway](https://twitter.com/DailyDevTips1/status/1287735721298726912)

## JavaScript Removing Duplicates from Array

We already had a full overview of the `Set` function before, but today we are using `Set` to remove duplicates from an array.

Let's start with the following array:

```js
var array = ['🤟', '🤟', 1, 'abc', '🤟', 1];
```

As you can see, we have the emoji three times and the number one twice.

So make this a unique non-duplicate array we simply call `Set` on it.

```js
var array = ['🤟', '🤟', 1, 'abc', '🤟', 1];
var set = new Set(array);
console.log(set);
// Set(3) {"🤟", 1, "abc"}
```

Wow, awesome and simple right!

`JavaScript` is not always complicated loops and functions; we have to leverage the write commands for the right solution.

Feel free to have a go on this Codepen.

%[https://codepen.io/rebelchris/pen/OJMGebq]

## Browser Support

Be aware; `Set` is not supported in the older IE versions!

![JavaScript Set support](https://caniuse.bitsofco.de/static/v1/mdn-javascript__builtins__Set-1595859501160.png)

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)

