Array.prototype.duplicate=function() {

let tmp = [];

this.concat().sort().sort(function(a,b){

if(a==b && tmp.indexOf(a) === -1) tmp.push(a);

});

return tmp;

}