Answers for "put duplicate elements into an array"

1

javascript create array with repeated values

Array(5).fill(2)
//=> [2, 2, 2, 2, 2]
Posted by: Guest on February-17-2021
0

duplicate numbers in an array javascript

[1, 1, 2, 2, 3].filter((element, index, array) => array.indexOf(element) !== index) // [1, 2]
Posted by: Guest on November-10-2020

Code answers related to "put duplicate elements into an array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language