Ideas: 1. To establish a new array, the value in the original value, writing in the new array
2. If this value does not exist in the new array, write; If existing won't write
2. Use the indexOf method -- remove duplicate letters (through the for... In to iterate over)
Ideas: 1. To establish a new array, the value in the original value, writing in the new array
2. If this value does not exist in the new array, write; If existing won't write
CodePudding user response:
The easiest way toVar newArr=new Set (arr) [...];
CodePudding user response:
The set and extension operators how sweet! Such as upstairsCodePudding user response:
Array. The from (new Set (,2,1,2,6,7 [1]))//,2,6,7 [1]