Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
208,480 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.