JavaScript Introducing ES2015 Objects and New Collection Types Map

Denis Savenko
PRO
Denis Savenko
Pro Student 6,994 Points

JavaScript Map is like Python dictionary?

I read about differents javascript object and map, but i came in JS from Python world. Is new javascript map it the same like python dictionary? Maybe they have any difference?

1 Answer

Steven Parker
Steven Parker
170,451 Points

They are similar in many ways. But then, ordinary JavaScript objects are also similar to Python dictionaries in many ways.

But one difference that comes to mind is that maps in JS are always iterated in insertion order. I believe one of the rules of Python dictionaries is they have no reliable order.

Denis Savenko
Denis Savenko
Pro Student 6,994 Points

Thank you for you answer. Yes in Python dictionaries haven't any order. Thank you for this note.