How the Book of JavaScript Tip Box Works

The Book of JavaScript website has a little textarea that shows various programming tips. The script keeps these tips in an array and then uses JavaScript to loop through the array, showing one tip at a time. Each tip stays in the textarea for 3.5 seconds before the next one appears. I should confess that I got the idea for this tip box from something that the search engine ask.com (http://www.ask.com, formerly known as Ask Jeeves) once had on its home page. In fact, I will present two different versions of the code. The first version, shown in Figure 8-13, is very similar to the code Ask.com originally used. The second version, which you'll see in Figure 8-14, is a bit simpler (though not necessarily better). ...

Get The Book of JavaScript, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.