Steve information is not displayed


#1

var friends={};
friends.bill={firstName:"xyz",lastName:"jai",number:22,address:["wh"]};
friends.steve={firstName:"nai",lastName:"ja",number:2,address:["w"]};
var n=function(){
for(var i=0;i<friends;i++)
console.log(friends);
};
var search=function(name){
for(var i in friends) {
if(friends[i].firstName === name){
console.log(friends[i]);
return friends[i]
}
}
};
search("steve");


#2

@boardsolver53992
The firstName properties
should be "Bill" and "Steve"
and you should then call the search function
like
search("Steve");


#3

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