So close to victory!


#1



I was trying to do the bonus section and get my output to look like the one they showed in the example but I keep getting the error that I was "missing ) after argument list" even though I did not change the list function at all. Could someone help me out?


Replace this line with your code. 
var friends = {

    bill: {
    firstName: "Bill",
    lastName: "Arde",
    number: "98766789",
    address: ["London", "Baker Street", "22B"]
    },
    
    steve: {
    firstName: "Steve",
    lastName: "Harvey",
    number: "12344321",
    address: ["Devon", "Soldier Island", "Soldier Manor"]
    },
    
    shanalotte: {
    firstName: "Shanalotte",
    lastName: "Unknown",
    number: "13572468",
    address: ["Lodran", "Majula", "Bonfire"]
    }
    
   
    
};
  var list = function () {
        for (var key in friends) {
            console.log(key);
            };
        };
        
   var search = function (name){
       for (var key in friends){
           if(friends[key].firstName === name){
               console.log("First Name: " + friends[key].firstName
                           "Last Name: " + friends[key].lastName
                           "Number: " + friends[key].number
                           "Address: " + friends[key].address);
               }
            
           };
       };
    
   search ("Shanalotte")


#2

Hi @j1nc,

If it may help please see the code sample snippet below.
In short the syntax gremlins paid you a visit, but it's nothing you can't overcome judging by the quality of your code :slight_smile: In this case we'll just focus specifically on the error you mentioned which takes place in the 'search function

   var search = function (name)
   {
       for (var key in friends)
       {
           if(friends[key].firstName === name)
           {
               console.log("First Name: " + friends[key].firstName + //don't forget to concatenate
                           "Last Name: " + friends[key].lastName + //all string literals
                           "Number: " + friends[key].number + //when used like this :)
                           "Address: " + friends[key].address);
           }            
        };
   };

#3

Thank you very much! The code works now.


#4

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