DEV Community

Discussion on: How to Get an Object Length

Collapse
 
gypsydave5 profile image
David Wickes • Edited

I enjoyed this article! "How to get an Object Length" really undersells it. Didn't know about the enumerable property - or the weird thing with symbols. Great piece of writing.

How would you use these features? I can understand enumerable being useful to get some level of 'privacy'/encapsulation into an JavaScript object. Are symbols with keys the same thing but more so? Are there any other uses?

Collapse
 
samanthaming profile image
Samantha Ming

Thanks David for the kind feedback! In regards to symbols, from the readings I gathered, it seems to serve one main purpose: create property keys without risking name collisions (since symbols are always unqiue). I have not personally used symbols in my daily programming yet. if you know of any other use cases, please do share. Might be an interesting one to cover in a future post, have to dig into it a bit further 😊