Anyone who knows JavaScript is well acquainted with object literals, the language's approach to a hash or dictionary like storage mechanism. They're a fantastic way to store data, especially when combined with arrays, and once a JS programmer discovers them, it's hard to go back to using multi-dimensional arrays or excessive variables. That's why we now have a full tutorial on object literals - creating them, modifying them, and making arrays of them.
In the challenges, students use object literals to describe a recipe, make a painting program, and review their favorite movies.



In the final project, students use what they've learnt about objects to create a virtual bookshelf of their favorite books - storing colors and ratings in the books, and using loops to tile them across multiple shelves.

No comments:
Post a Comment