Pease help with javascript code..iam stuck


#1

https://www.codecademy.com/en/courses/javascript-beginner-en-3bmfN/0/7?curriculum_id=506324b3a7dffd00020bf661#

this code say:"It looks like your search function doesn't return contact information for Steve". but it does print steve info on the screen


var friends = {
    bill :{
        firstName:'bill',
        lastName:'marc',
        number:'9787654599',
        address:['ten','merton drive','derby']
    },
    steve :{
        firstName : 'steve',
        lastName: 'male',
        number :'09864588',
        address : ['five','coronationstreet','london']
    }
};
var list = function(friends) {
    for(key in friends) {
        console.log(key);
    }
}
var search = function(name) {
    for(key in friends) {
        if(friends[key].firstName === name) {
            console.log(friends[key]);
            return friends[key];
        }
    }
}
search("bill")
search("steve")


#2

HI inside your object bill and steve

    bill :{
        firstName:'bill',
        lastName:'marc',
        number:'9787654599',
        address:['ten','merton drive','derby']
    },
    steve :{
        firstName : 'steve',
        lastName: 'male',
        number :'09864588',
        address : ['five','coronationstreet','london']
    }

these lines

firstName:'bill',
...

firstName : 'steve',

you should write steve and bill with the first letter uppercase like that Steve and Bill


#3

thanks a LOT wizmarco....problem solved....THANK YOU


#4

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