O'Reilly logo
  • Jeffrey Damon thinks this is interesting:

Let's look at a more useful example:

// Define a function that sets a DOM node's color
// to yellow and then fades it to white.

var fade = function (node) {
    var level = 1;
    var step = function (  ) {
        var hex = level.toString(16);
        node.style.backgroundColor = '#FFFF' + hex + hex;
        if (level < 15) {
            level += 1;
            setTimeout(step, 100);
        }
    };
    setTimeout(step, 100);
};

fade(document.body);

We call fade, passing it document.body (the node created by the HTML <body> tag). fade...

From

Cover of JavaScript: The Good Parts

Note

Study this. What is this...