
Object-Oriented JavaScript - Second Edition
By :

In the previous chapters, the solutions to the exercises could be found in the text of the chapter. This time, some of the exercises require you to do some more reading (or experimentation) outside this book.
BOM: As a BOM exercise, try coding something wrong, obtrusive, user-unfriendly, and all in all, very Web 1.0, the shaking browser window. Try implementing code that opens a 200 x 200 pop up window and then resizes it slowly and gradually to 400 x 400. Next, move the window around as if there's an earthquake. All you'll need is one of the move*()
functions, one or more calls to setInterval()
, and maybe one to setTimeout()
/clearInterval()
to stop the whole thing. Or here's an easier one, print the current date/time in the document.title
and update it every second, like a clock.
DOM:
Implement walkDOM()
differently. Also make it accept a callback function instead of hard coding console.log()
Removing content with innerHTML
is easy (document.body.innerHTML = ''
), but not always best...
Change the font size
Change margin width
Change background colour