Answers for "create array with all same values javascript"

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 "create array with all same values javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language