Question: Let's say I had an array containing unique values, and I wanted to check if a certain element existed:

```
var bannedIPs = ['0.0.0.0', '127.0.0.1', '192.168.1.1', '192.168.1.2'];
var isBanned = bannedIPs.includes('0.0.0.0'); // true

```

This works fine, except for the fact that it uses linear search, meaning that for an array of N elements, it would take N iterations to check if an element existed.

A much faster way to do this would be to use an object:

```
var bannedIPs = {'0.0.0.0': null, '127.0.0.1': null, '192.168.1.1': null, '192.168.1.2': null};
var isBanned = bannedIPs.hasOwnProperty('0.0.0.0'); // true

```

This method uses O(1) lookup, which is done in constant time, leading to much better performance.

However, notice how I have to store arbitrary values for the keys. Is there any other method that is potentially more suitable for this task, one that maybe doesn't require you to store values for each key?

Answer: 
Use a Set instead. Unlike an array, and unlike an object, and unlike a Map, Sets are collections of just *plain values*, without any associated key.

```
var bannedIPs = new Set(['0.0.0.0', '127.0.0.1', '192.168.1.1', '192.168.1.2']);
var isBanned = bannedIPs.has('0.0.0.0'); // true

```
You can use a [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set).

```
var bannedIPs = new Set(['0.0.0.0', '127.0.0.1', '192.168.1.1', '192.168.1.2']);
var isBanned = bannedIPs.has('0.0.0.0');

```