<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title>Document</title></Head><Body> <Script> //adds a function to the array type so that it can go back to theArray.prototype.eraseDuplicate= function() { var After= {}; varRe= []; for (varI= 0; I< This. length; I++) { if (!after[ This[i]]) {after[ This[i]]= 1; Re.push ( This[i]); } } returnre; }; Console.log ([1, 2, 3, 3, 4, -, 6, 6].eraseduplicate ()); //write a number that can be found on a two-bit array (not duplicated) vararr= [2, 3, [4, 6, [3, 8]], A, Ten]; Array.prototype.getUnq= function() { varRS= []; vararr= This; (functionGetunique (arr) { for (varI= 0, Len=arr.length; I<Len; I++) { if(Arr[i].constructor==Array) {Arguments.callee (arr[i]); } Else { if(Rs.indexof (arr[i])== -1) {Rs.push (arr[i]); }}}) (arr); returnrs; } RS=Arr.getunq (); Console.log (RS); //PS Recursive functions should always use Arguments.callee </Script></Body></HTML>
Array de-weight