7/8 help


var friends = {
bill: {
firstName: "bill",
lastName: "gates",
number: "(245) 555-5555",
address: ['One Microsoft Way', 'Redmond', 'WA', '98052']
steve: {
firstName: "steve",
lastName: "jobs",
number: "(345) 555-5555",
address: ['Two Apple Way', 'Redmond', 'CA', '95014']
var list = function(friends) {
for (key in friends) {
var search = function(name) {
for (var key in friends) {
if(friends[key].firstName === name) {
return friends[key];

it says my function doesn't return contact information for steve


This code works fine when I try to run it. Does the output provide anything else as an error?


am also facing the same problem


var friends = {
Bill: new Object(),
Steve: new Object(),

list : function () {
for (var x in friends) {

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


friends.Bill.firstName = "Bill";
friends.Bill.lastName = "Gates";
friends.Bill.number = "800-555-8888";
friends.Bill.address = ['some address, some address'];

friends.Steve.firstName = "Steve";
friends.Steve.lastName = "Someone";
friends.Steve.number = "900-555-3853";
friends.Steve.address = ['some address, some address', 'third addy line'];


This is my slightly different take, but still having problems with "Steve" apparently not providing the correct results. Any help appreciated.


I am encountering the same problem. I cannot find any errors in my code but it still gives me the same error code every time.
"Oops, try again. It looks like your search function doesn't return contact information for Steve."

Here is my code

//Creating Contact List
var friends = {};
friends.bill= {
firstName: ("Bill"),
lastName: "Blankocheck",
number: "(407)123-1234",
address:["unknown street","Sometown","66677","WA"]
friends.steve= {
firstName: ("Steve"),
lastName: "Plakiotis",
number: "(321) 444-8889",
address: ["666 satans street","orlando","32801", "Fl"]

//List Function
var list=function(obj){
for(var key in obj)

//Search and Display Function
var search = function(name){
for(var key in friends){
return friends[key];
console.log("They're not in our book");
return "They're not in our book";




I had a similar problem which turned out to be a typo... check caps, commas, and semicolons maybe?



In your var list function, you should have a "var" before key"

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

Also codeacademy says you're missing Steve, so in its answer check it is looking for a capital Steve (and a capital Bill instead of lowercase steve lowercase bill). Once you capitalize the names in your code you should get the desired output the lesson is looking for.



In your search and display function remove the return statement:

return "They're not in our book";

I am not too clear on why that is not valid, but it's for some reason taking this response instead of picking up Steve.



Thank you three times. I appreciate this so much.

One question.

If that extra return line had been in a regular javascript word processor and not in codecademy do you think it would have behaved the same way?


In his original code. Why did you put that?



I also couldn't understand why your code wouldn't work. I have a feeling that it may be just the way Codecademy checks the final answer of your output, but I can't say for certain. Here, I also use this as a resource sometimes: https://repl.it/languages/JavaScript
That site lets you run your script to test as if in a native environment and on running your code it seems to check out fine. Hope that helps.


@joanneyeung thanks for that repel.it site, it logged my code the way It was supposed to, rather than repeating my objects multiple times to the console.