so object.keys will do a loop so we are talking about O(n) complexity while maintaining a count is O(1). So if we have 10000 elements in the map that is starting to be expensive. Also the map should be iterrable, I guess yours isnt yet :)
I am a software Developer, experienced in both front and back-end development, proficient in HTML5, CSS3, SASS, JavaScript, Reactjs, Nodejs, Expressjs and Mongodb etc.
so object.keys will do a loop so we are talking about O(n) complexity while maintaining a count is O(1). So if we have 10000 elements in the map that is starting to be expensive. Also the map should be iterrable, I guess yours isnt yet :)
Thanks!