Does anyone know why there isn't a single standard "number of things" property for built in types?
I'm relatively new to JavaScript and was surprised when I tried to get a length on a Map. After some reading I found that Arrays have length and Maps have size, but can think of no useful reason they differ.
I realize Maps have more things to count inside than Arrays, but "number of keys" feels close enough to "number of elements" to me. I think I was checking if they were empty at the time. Maybe there is a JavaScript idiom I don't already know for that instead of length == 0?
Was the goal to break code that expected one and got the other? If so I can only shake my head.
I've tried a few searches, but nothing feels relevant that I can find. Most results were explaining how to use these structures, which I can already do. Or why something fails one place and not another (apparently jQuery has a size method that confuses people, and won't work in JavaScript proper).