Sv443/JSLib-npm

[Feature] Function that removes duplicates from an array

Closed this issue · 0 comments

Sv443 commented
/**
 * Removes duplicate items in an array
 * @param {Array<*>} array An array with any values that can be compared with the [strict equality comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness)
 * @returns {Array<*>}
 */
function removeDuplicates(array) {
    return array.filter((a, b) => array.indexOf(a) === b);
}