💾arr.removeDuplicates()

JSvalueobjectbuilt-inArrayextension ⟩ arr.removeDuplicates()

Object.defineProperties(Array.prototype, {
    // 🔹 .removeDuplicates()
    removeDuplicates: {
        value: function() {
            return [... new Set(this)];    // new array (non-mutating)
        },
    },
});

Last updated