Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJeanette Trudell
11,460 PointsI only have experience with one other programming language (Ruby), but aren't these object literals just hashes?
This is just the first video, so perhaps it gets more complicated, but what he is describing seem to be simple key/value pairs.
5 Answers
hightechnomad
1,482 PointsIt is a little bit odd indeed, personally for me coming from the Python world - these objects are definitely associative arrays. Me too I was expecting to see here the OOP stuff but I think that's covered in later courses. I've poked around the net and I think I've found the answer:
"Objects in JavaScript are kind of two-faced. From one side, an object is an associative array (called hash or dictionary in some languages). It stores key-value pairs. From the other side, objects are used for object-oriented programming, and thatβs a different story."
Also If I understand properly, in JavaScript, there are no classes - instead, an object inherits from another object (but I guess that's covered later also).
Daniel Newman
Courses Plus Student 10,715 PointsObjects in JavaScript are hashes, maps, whatever you decide to call them, but... Most of JS entities are Objects. =)
Tyler Rollins
5,950 Points@Jeanette Trudell I'm glad to see someone else coming from ruby, thinking JS objects are simply hashes as well. I had the same thought, and have yet to see otherwise. Maybe in a more advanced course, their differences with emerge?
sibal gesekki
3,484 PointsNO
Jeanette Trudell
11,460 PointsI suppose if you were coming from JS to Ruby, you might be equally confused by Ruby's hashes!
willyraider
6,550 PointsKenneth Love told us that everything is an object. At least in python :-)
Andrew Stillson
5,577 PointsKenneth Love is so dreamy... oh, that's not the topic!