Is there a simple way to add an object to an array in ES6 while ensuring it is unique?
For example:
MyArray.pushUniquely(x);
Or is it better to stick with the older method like this? :
MyMethod(x) {
if ( MyArray.IndexOf(x) === -1 )
MyArray.Push(x);
}
Any suggestions for pushing objects uniquely using ES6?