Task link: Classes in JavaScript - Learn web development | MDN
And the bio only includes two interests, even if more are listed in the interests
array. Can you work out how to fix this in the class definition (constructor)?
I had a problem with this part of the task.
This problem appears in the condation when using the loop through the elements of the array
Uncaught TypeError: Cannot read properties of undefined (reading ‘length’)
This is what I did: https://codepen.io/someone_49/pen/qBXyrxE?editors=0010
Any advice on how to fix this would be greatly appreciated 
Hello @albaraa_1949
you doing great here the fixed one
https://jsfiddle.net/jLoh7u0d/
you have some missing ; and there extra , and the big one that int need to return a value which you did not
hope that help and have a nice day 
hope that he
1 Like
Just looking at your code, its a bit long but it works. Line 18 remove “return”, line 17,19 and 23 remove the period. or you will get double period with the one in line 32. Add a line 40 just to call the greeting function => person1.greeting().
thanks @Mitchell_Andrade looks like he modified since last time i checked it
@albaraa_1949 but the code will not work in case if there more than 2 interests cause of those nested for loops
try to click on the arrow on the upper left corner in codepen and choose analays javascript you will find many extra and missing semicolon
and sure the dot that @Mitchell_Andrade mentioned would give you nightmare
and have a nice day both of you 
1 Like
Can you explain this more please?
try to check this line
let person1 = new Person("Bob", "Smith", 32, "male", "music", "skiing", "play");
and see the alert message it only show the music in the alert
also change it to
let person1 = new Person("Bob", "Smith", 32, "male", "music", "skiing");
it will work fine also if it
let person1 = new Person("Bob", "Smith", 32, "male", "music");
now go step by step
let us assume interest has 3 elements
first for loop from go from 0 to 2
then it will check the if and the only valid one that will run is the one with the for loop this for loop will run the following if
if (i === interests.length - 1) {
return `and ${interests[i]}.`;
} else { when i =0 the first time it run the else will be excuted that will make the function return `${interests[i]}, ` which will be the first element
return `${interests[i]}, `;
}
also using same variable i in this case for both for loops would be hard to debug and of course sometime we need that
hope that help and have a nice day 