Question 12 loops and arrays II... Won't load page!


Question 12 loops and arrays II in javascript

There is no error message the page just wont load and i cant figure it out... I probably keep crashing my browser... plz help me!

var names = ["Jeff", "Tri", "Renée", "Doug"];
for (var i = 1; names.length>1; i++){
console.log(" I know someone called " + names[i] );


Hi it's a infinit loop here

for (var i = 1; names.length>1; i++)

name.length will always be great than 1..
so you should change the > with > then you saved 1 in i so you should use it so this part will bel like that

names.length > i

then instead of var i = 1 you should put it equal to 0


Your names.length = 4. 4 > 1 always will be true, so your loop will never end.


Or can we do (var i=1; names.length>=i; i++)?


thank you so much for your help but I am getting an error saying Oops, try again. Your code should have printed 'I know someone called Jeff', but didn't. Make sure to type the 'I know someone called ' part exactly right, and don't forget the space between that phrase and the name!... I dont no what to do...
var names = ["Jeff", "Tri", "Renée", "Doug", "Samantha"];
for (var i = 1; names.length < 1; i++){
console.log("I know someone called" + names [i] );

plz help


Or can we do (var i=1; names.length>=i; i++)?

first i should be equale to 0
In this lesson it isn't correct because


names.length is equal to 5 and in the array you start to count from 0?
so with this

(var i=0; names.length >= i; i++)

0 < 5 --->  "Jeff"
1 < 5 --->  "Tris"
2 < 5 --->  "Renée"
3 < 5 --->  "Doug"
4 < 5 --->  "LAs" #it's also missing one name in his code
#you already print the five names they aske you to print so with => thsi one will give you an error
5 < 5 --->   #undefined

so you should only put > and not >=


Thank you so much your help is much appreciated!