Can someone kindly fpnd the error in my code please?


#1

var friends = new Object();
friends.bill = new Object();
friends.steve = new Object();

friends.bill.firstName = "Bill";
friends.bill.lastName = "Gates";
friends.bill.number = "(204) 444 555";
friends.bill.address = ["Germay","Marburg","7"];

friends.steve.firstName = "Steve";
friends.steve.lastName = "Jobs";
friends.steve.number = "555326";
friends.steve.address = ["Germay","Marburg","1"]

var list = function(friends) {
for (var bill in friends) {
console.log (bill);
}
};
var list(friends);
var search = function (name) {
for (var bill in friends) {
if ( friends[bill]firstName === name ) {
//console.log(test++);
console.log(friends[bill]);
return friends[bill];
}
}
};
list(friends);
search("bill");


#2

@netrockstar26947 What's the error you're getting?


#3

SyntaxError: Unexpected token (

this is what it says as the error


#4

you are missing a . in there as well

var search = function (name) {
for (var bill in friends) {
if ( friends[bill].firstName === name ) { on this line

i dont think that will fix your issue but its a start
otherwise this looks exactly like mine and im getting "steve is not defined" as an error


#5

thanks for your help but still doesnt work :((((((