Answers for "how to get number of a specific element of an array"

0

how to get number of a specific element of an array

// Let has local scope
let array = [1, 2, 3, 5, 2, 8, 9, 2]

// Functional filter with an Arrow function
array.filter(x => x === 2).length  // -> 3
Posted by: Guest on March-27-2022

Code answers related to "how to get number of a specific element of an array"

Browse Popular Code Answers by Language