Solution for constructor instead of literal?


#1


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


"Did you create a function called list". No other error messages


function Friends(first, last, number, address) {
  this.firstName = first;
  this.lastName = last;
  this.number = number;
  this.address = address;
}

var bill = new Friends("Bill", "Gates", "(206) 555-5555",['One Microsoft Way', 'Redmond', 'WA', '98052']);
var steve = new Friends("Steve", "Jobs", "(206) 666-6666",['Two Apple Way', 'Bluemond', 'AW', '12345']);

var list = function (friends) {
  for (var key in friends) {
    console.log(key);
  }  
};


#2

i wouldn't use constructor here, it makes this exercise (and the coming exercise) really tricky


#3

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