7. Search for a friend



ReferenceError: steve is not defined

var friends = {
    bill: {
        firstName: "Bill",
        lastName: "Gajic",
        number: "062/232-448",
        address: ["Milosa Obilica", 145, "Nova Pazova", 22330]
    steve: {
        firstName: "Steve",
        lastName: "Jovancevic",
        number: "064/895-136",
        address: ["Boska Buhe", 104, "Nova Pazova", 22330]

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

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



steve needs to be in double quotes (when searching )


Hey zainabrawat,
Thanks, it worked out! But im not sure the output i get is what i actually want... I'll show you what it printed:


Which part you didn't expect?

When you console.log an object you will get all the brackets, etc. If you want to instead print only the keys or values then you have to loop through them one by one. -@albionsrefuge Thank you



Allright, i think i get it now. Thanks a lot for your help!