narri < 0. You need the length of the array this.lengthinclude its includes
Array.prototype.uniq = function() {
let narr = [];
for (let i = 0; i < this.length; i++) {
if (!narr.includes(this[i])) {
narr.push(this[i]);
}
}
return narr;
}
console.log([1, 2, 2, 3, 3, 3].uniq()); * Be the first to Make Comment