When the written test tense did not write out, calm down after the heart found simple to die.
<!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTMLLang= "en"><Head> <Metahttp-equiv= "Content-type"content= "Text/html;charset=utf-8"> <title>Delete array repeating elements</title></Head><Body> <Script> /** * Delete array repeating element * @param array target array * @return return to the arrays after deduplication*/ functionArray_unique (arr) {//Outer loop Control order for (varI= 0; I<arr.length; I++) { //Inner Loop to find if there are duplicate values for (vark=I+ 1; k<Arr.length; k++) { if(Arr[i]==Arr[k]) {Arr.splice (k,1); } } } returnarr; } vararr= [ A,3,2,3,5,5,6,7]; Console.log (Array_unique (arr)); </Script></Body></HTML>
Output Result:
[12, 3, 2, 5, 6, 7]
Delete array repeating elements for JavaScript pen questions