Debugging a simple JavaScript code

javascript

Solution

You didn't tell the browser to output the values.

By default it writes out the result of the last executed line which is `(name + ' : ' + myObject[name])`

To solve this simply add `console.log`:

var myObject = {
"first_name" : "Rick",
"last_name" : "Hummer"
};

var name;
for (name in myObject) {
  if(typeof myObject[name] != 'function') {
    console.log(name + ' : ' + myObject[name]);
  }
}

Works for Firefox 19:

Problem

Started learning Javascript and I wrote something like this in FireBug of FireFox: ``` var myObject = { "first_name" : "Rick", "last_name" : "Hummer" }; var name; for (name in myObject) { if(typeof myObject[name] != 'function') { (name + ' : ' + myObject[name]) } } ``` When I run it, it only shows the last name, shouldn't it also list first name ? Plus how can I put break points and debug this anyway?

Original source