Did you remember to call list() ERROR



/* Interpreter returns same message. Please advise..
Oops, try again. It looks like you didn't log "tim tom" to the console. Did you remember to call list() after adding your new contact?*/

var bob = {
    firstName: "Bob",
    lastName: "Jones",
    phoneNumber: "(650) 777-7777",
    email: "bob.jones@example.com"

var mary = {
    firstName: "Mary",
    lastName: "Johnson",
    phoneNumber: "(650) 888-8888",
    email: "mary.johnson@example.com"

var contacts = [bob, mary];

function printPerson(person) {
    console.log(person.firstName + " " + person.lastName);

function list() {
	contactsLength = contacts.length;
	for (var i = 0; i < contacts.Length; i++) {

/*Create a search function
then call it passing "Jones"*/

function search(lastName){
    contactsLength = contacts.length;
    for(var i=0;i<contacts.length;i++){
    function add(firstName, lastName, email, phoneNumber){
object = {
firstName: firstName,
lastName: lastName, 
email: email, 
phoneNumber: phoneNumber
contacts[contacts.length] = object;

add("tim", "tom", "timtom@example.com", "32874683275");



Does "tim tom" get printed when you call list ? If not, should it have? And if it should have, which steps should have happened to result in that having been printed? Did those steps happen? Add some prints and find out where it went wrong in those steps.


I think you meant to leave out the period between contacts and Length.


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