Count number of elements in JavaScript array

// Write a function that takes an array (a) as argument
// Return the number of elements in a
function
myFunction
(
a
)
{

return
}
Test Cases:
myFunction([1,2,2,4])
Expected
4
myFunction([9,9,9])
Expected
3
myFunction([4,3,2,1,0])
Expected
5

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