pg 225 test 2 create an object inspector

by Lucille Kenney

JavaScript

//Or if you wanted to create an object inspector (another debugging tool), that might be defned like so:

function displayObject(obj) {
    for (var p in obj) {
        console.log(p + ‘ = ‘ + obj[p] + ‘\n’);
    }
}

/*That code merely wraps functionality explained in Chapter 6, Complex Variable 
Types, in a function that takes one argument: the object to be inspected. And this 
is what defning your own functions is about: encapsulating code you repeatedly 
use, and providing, as arguments, the data the code requires.*/