i try to extend Array object in javascript with some user friendly methods like Array.Add() instead Array.push() etc...
i implement 3 ways to do this. unfortunetly t
You can also use this way in ES6:
Object.assign(Array.prototype, { unique() { return this.filter((value, index, array) => { return array.indexOf(value) === index; }); } });
Result:
let x = [0,1,2,3,2,3]; let y = x.unique(); console.log(y); // => [0,1,2,3]