Search doesn't work properly


My problem is that is doesnt only print the contact info for Denis, but for everyone, I dont see what I did wrong.. Can anyone else see what I did wrong? Thank you.

var friends = {
    bill: {
        firstName: 'Bill',
        lastName: 'Gates',
        number: '(111) 111-1111',
        address: ['Gates Drive','Las Vegas','CA','111111']
    steve: {
        firstName: 'Steve',
        lastName: 'Jobs',
        number: '(222) 222-2222',
        address: ['Jobs Drive','Miami','FL','222222']
    denis: {
        firstName: 'Denis',
        lastName: 'Tur',
        number: '(333) 333-3333',
        address: ['Tur Drive','Plymouth','MN','333333']

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


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



For less verbose output, comment the call to list(). Remember that the SCT calls the function, too, so the output may be duplicated.


I'm not sure what SCT means, also if i comment the list(friends); then it doesnt print out the list... lol not sure what that has to do with this. Also if I comment the search('Denis'); it still prints out 3 contacts, two of which are Steve and one is Bill, why isn't Denis printed out? Really don't know what I did wrong..


Submission Correctness Test -- the lesson checker program behind the exercise.

There is nothing wrong with your code, that I can see. Is it letting you pass the exercise?


Oh, ok thanks. So basically the SCT can make duplicates, but if I were to use some other editor it wouldnt make the duplicates.. (I tried and i think it worked)

Thanks :slight_smile:

And yea it does let me pass, I just didn't want to pass with mistakes which I could repeat later.