Liliia Dokuchaeva’s Post

Got a minute for some JavaScript? 😚 What does this code output? Answer 🔍 >>> undefined I don’t really like questions where you just have to be attentive, but I think this is something worth paying attention to. To get the number of entries in a *Map*, you use the *.size* property, not *.length* like in arrays. In short: .length --> Arrays, Strings, function parameters .size --> Map, Set #javascript #webdevelopment

  • graphical user interface, chat or text message

It would be undefined as length is not a valid property of Map. It should be map.size

See more comments

To view or add a comment, sign in

Explore content categories