My code is not working for some reason. need help!


Why is this not working? I'm frustrated.

"Oops, try again. It looks like your search function doesn't return contact information for Steve."

var friends = new Object();

friends.bill = {
    firstName: "bill",
    lastName: "anderson",
    number: "0732456765",
    address: ['hasslerorsvagen', 14, 54272, 'Mariestad', 'Sverige']
friends.steve = {
    firstName: "steve",
    lastName: "peterson",
    number: '0732873942',
    address: ['tomtevagen', 54, 34653, 'Flakmopedstaden', 'Finland']

var list = function(friends){
    for (var key in friends){

var search = function(name){
    for (var key in friends){
        if(friends[key].firstName === name){
            for (var x in friends.key){
            return friends[key];



Please don't be frustrated. You should be doing:


And not:

Then, you should do:


And not:


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