Horrible Howto - Create Unique Only Array

Wield the power of Immutable Sets and JavaScript Sets.

Immutable:

const { List } = require('immutable');

const list = List([1,2,3,4,4,4,4]);

const uniqueList = newList.toSet();

ES6:

const list = [1,2,3,4,4,4,4];

const uniqueSet = new Set(newList);

const uniqueList = [...uniqueSet];
Show Comments

Get the latest posts delivered right to your inbox.