Home > front end >  An array of how to remove duplicate values
An array of how to remove duplicate values

Time:09-24

A. Use the indexOf method - remove duplicate Numbers (iterates through the forEach)
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 to
Var newArr=new Set (arr) [...];

CodePudding user response:

The set and extension operators how sweet! Such as upstairs

CodePudding user response:

Array. The from (new Set (,2,1,2,6,7 [1]))//,2,6,7 [1]
  • Related