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.
![](http://3.bp.blogspot.com/-8xHCc5nImWA/Uuc_42e5YDI/AAAAAAAAARc/qBz67BV3JtM/s320/Screenshot+2014-01-27+21.27.54.png)
![](http://4.bp.blogspot.com/-1yT1sNVIxO4/Uuc_4vlmU-I/AAAAAAAAARY/ySV3KGFbRKo/s320/Screenshot+2014-01-27+21.25.24.png)
![](http://3.bp.blogspot.com/-Id1FvY4czKY/Uuc_44dej7I/AAAAAAAAARk/TQ5iYxxwhK8/s320/Screenshot+2014-01-27+21.27.00.png)
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.
![](http://3.bp.blogspot.com/-ibYmK7laz54/Uuc-iOnDqRI/AAAAAAAAARQ/YcCSgeJEfoU/s560/Screenshot+2014-01-27+21.21.09.png)
No comments:
Post a Comment