essential-vanilla-javascript-functions
essential-vanilla-javascript-functions copied to clipboard
Simplify array_unique
Use Array.prototype.indexOf instead of custom key comparator.
This change probably makes function slower due to indexOf probable O(n) timing, but clarity of the code is more important than the performance in this case.
indexOf will only compare the content's indices, not it's contents if those are objects, arrays or NaN. Therefore, this breaks the current functionality.