Can you tell me what is wrong with the code? it logs the functions but everything inside meaning the whole code


#1


0
1
2
3
bill
{ firstName: 'Bill',
lastName: 'Gates',
number: '222322',
address: [ 'Beverly Hills' ] }
{"firstName":"Bill","lastName":"Gates","number":"222322","address":["Beverly Hills"]}


var friends ={
    bill: {firstName: "Bill",
    lastName: "Gates",
    number: "222322",
    address: ["Beverly Hills"]
    },
    steve:{firstName :"Steve",
    lastName: "Jobs",
    number: "2132123",
    address: ["Virginia Beach"]}
    };
    
    var list = function(friends){
        for(var key in friends){
            console.log(key);
            }
        };
        
        var search = function(name){
            for(var key in friends){
                console.log(key);
                if(friends[key].firstName = name ){
                    console.log(friends[key]);
                    return friends[key];
                    }
                }
                
            };
    
   list("Bill");
   search("Bill");


#2

friends[key].firstName === name


#3

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