Head First JavaScript Code: Chapter 9, Bringing Data to Life
JavaScript objects aren't nearly as gruesome as the good doctor might have you think.
But they are interesting in that they combine pieces and parts of the JavaScript language together so that they're more powerful together. Objects combine data with actions to create a new data type that is much more "alive" than data you've seen thus far. You end up with arrays that can sort themselves, strings that can search themselves, and scripts that can grow fur and howl at the moon! OK, maybe not that last one but you get the idea...
Download the Code
Code Description and Viewing
YouCube
The YouCube web page is built incrementally throughout the chapter. Each numbered HTML file corresponds to an incremental version of the web page. When a page number appears beside a file, it is either the page where the file's contents are presented or the exercise (solution) corresponding to the file.
- youcube1.html - YouCube web page with blog entries as simple objects (page 407)
- youcube2.html - YouCube web page with each blog date stored as a Date object (page 414)
- youcube3.html - YouCube web page with the cryptic date problem fixed thanks to some date formatting (page 418)
- youcube4.html - YouCube web page with a custom comparison function literal that sorts the blog entries (page 422)
- youcube5.html - YouCube web page with a blog search feature (page 430)
- youcube6.html - YouCube web page with a random blog view feature (page 438)
- youcube7.html - YouCube web page with custom functions moved into Blog object methods (page 443)
- cube.png - Cube image that appears on the YouCube web page






