How to get the size of an array in JavaScript