Loop The Loop


#1

I need help with the Loop the Loop section, It keeps returning "There was a problem with your syntax", and the console returns:SyntaxError: Unexpected token {

// Our Person constructor
var person = new Function(name,age){
    this.name = name;
    this.age = age;  }  

// Now we can make an array of people
var family = Array();
family[0]= new person("alice",40);
family[1]= new person("bob",42);
family[2]= new person("michelle",8);
family[3]= new person("timmy",6);


// loop through our new array
for (i=0;i<family.length;i++){ console.log(family[i].name);}


#2

here:

var family = Array();

if ou want to use this way to create a new Array, you need to use the new keyword


#3

That`s Still no use.


#4

here:

var person = new Function(name,age)

the Person should have an uppercase fist letter, the exercise expects the right name (this is case sensitive)

a function shouldn't have a new keyword

keywords are case sensitive, function is all lowercase

if you need more help, post an updated version of your code


#5

Thank you, all good :slight_smile:


#6