Can't pass the "List 'em all" exercise


What is wrong with my code? I have followed the instructions, but for some reasons it gives me a syntax
error, saying "Unexpected token var".

var friends = {
    bill: {
        firstName: "Bill",    
        lastName: "Node",
        number: "060 - 1234567",
        address: ["Redwood Square"]
    steve: {
        firstName: "Steve",    
        lastName: "Johnson",
        number: "060 - 7654321",
        address: ["Vespucci Beach"]
    var list = function (friend) {
    for (var friend in friends) {


the list function should be after you finished building your friends object


You function uses global variable and not universal. Much more effective to make universal functions. Like this:

function list(inputObject){
    for (var objectKey in inputObject){

And yes, after object building.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.