SyntaxError: Unexpected token for


#1

`var friends = new Object();
var list = function(friends)
for (var list in object) {
console.log(list)

var friends = {
bill: {
firstName: "Bill",
lastName: "Gates",
number: "(206) 555-5555",
address: ['One Microsoft Way', 'Redmond', 'WA', '98052']
},
steve: {
firstName: "Steve",
lastName: "Jobs",
number: "(206) 555-5555",
address: ['One Apple Way', 'Slicion Valley', 'CA', '94027']
}
};`


#2

Your effort to format the code falls slightly short. Please edit your post and make it three back-ticks instead of one, before and after the code. Thank you.

var list =  function (friends)

The function lacks a code body:

... = function (...) {
    // for statement code
};

It is very bad practice to use variable names that match that of the function. This can create conflicts, if it runs at all. Try using a generic name that describes the purpose of the variable:

var list = function (obj) {
    for (var key in obj) {
        console.log(key) 
    }
};
list(friends);