Count number of elements in JavaScript array
How to solve it
This challenge can be solved by using
array.length
. The length property exists on every instance of an array and stores the number of elements inside the array. const arr = [1,2];
console.log(arr.length);
// output: 2