When to Use Map instead of Plain JavaScript Object

added by JavaScript Kicks
10/11/2019 9:45:54 AM

380 Views

JavaScript plain objects { key: 'value' } are meant to hold structured data. But one thing I find annoying: the object keys have to be strings (or rarely used symbols). What happens if you use numbers as keys? There's no error in such case: JavaScript just implicitly converts object's keys to strings.


0 comments