6. List them all Contact list



Hi, so I think I'm just really confused on what this is asking for.
My error message has been: Oops, try again. It looks like your list function isn't printing the right output.
When I run this code I get the information for Steve. These are the instructions. Any help would be so appreciated. I've read other forums about it but I just don't understand! TYSM

  1. Create a function list that takes a single parameter.
  2. In the body of the function, write a for/in loop.
  3. In the loop, use console.log to print out the key. (For example, if you only have bill and steve as entries, list should just print out "bill" and "steve".)

var friends = new Object();

friends.bill = {
    firstName: "Bill",
    lastName: "Gates",
    number: "(410) 422-5778",
    address: ['17439 Delaware Dr', 'Newark', 'DE', '19971']
friends.steve = {
    firstName: "Steve",
    lastName: "Mens",
    number: "(410) 410-4223",
    address: ['37 Boston St', 'NorthFront', 'DE', '19718']
    var list = function(friends) {
    for (var steve in friends); {


Nevermind, I realized it was because of a misplaced semi colon. This seems to happen to me often, if someone would like to explain the use of semi colons I'd really appreciate that too! Thanks!


This article here explains the use of Semi colons indepth:

Use of semicolons in JS

In a nutshell, they are used to denote an end of line.


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