. 1 <! DOCTYPE HTML > 2 < HTML > . 3 < head > . 4 < Meta charset = "UTF-. 8" > . 5 < title > </ title > . 6 < Script type = "text / JavaScript" > . 7 / * . 8 Slice ( ) 9 can be used to extract specified elements from array 10 which does not change the original array, but the package will be taken to a new array element returns 11 parameters [start, End) 12 is an index start position taken 1 comprising 13 index 2. the end position is not taken include 14 The second parameter can not write, showing all the elements taken from the beginning to the end of the 15 index may pass a negative value, a negative value if passed, the forward calculation from 16 -1 penultimate one . 17 -2 the last to the last 18 is * / . 19 var ARR = [ 12 is , 23 is , " RT " ]; 20 is var Result = arr.slice ( - . 3 ); 21 is the console.log (Result); 22 is / * 23 is splice () 24 for remove the specified element array 25 using the splice () will affect the original array, will be deleted from the specified color original array 26 and will be removed as a return value returned element 27 parameters 28 The first index represents the start position of the 29 second number represents the deleted 30 third and can pass after some new elements, these elements will be automatically inserted in front of the start position of the index 31 * / 32 33 is 34 is // array to exercise weight 35 var A = [ . 1 , 2 , . 3 , . 6 , . 6 , . 5 , . 3 ]; 36 for ( var I = 0 ; I < a.length; I ++ ) { 37 [ for ( var J = I + . 1 ; j<a.length;j++){ 38 if(a[i]==a[j]) 39 {a.splice(j,1); 40 j--; 41 } 42 } 43 } 44 console.log(a); 45 </script> 46 </head> 47 <body> 48 </body> 49 </html>