Introduction to 'For' Loops in JS


not sure what is wrong with my code here. it is written that "My code should have printed 'I know someone called Jan', but didn't." but actually it did! could someone help me to solve the problem here?

my code:
var names = ["Jan", "Paweł", "Lidia", "Tomek", "Krzys"];

for (var i=0; i < 5; i++){
console.log("I know someone called:" + names[i]);

the result:
I know someone called:Jan
I know someone called:Paweł
I know someone called:Lidia
I know someone called:Tomek
I know someone called:Krzyś

and the "error message" I received afterwards:
Oops, try again. Your code should have printed 'I know someone called Jan', 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!


you have print:

I know someone called:Jan

however, you should have a space between called and Jan, not a colon


Hey @agaczi! That task is a little picky but delete the : colon. And add a space. It should work after that! Hope this helped!


thank you both so much! indeed, that heleped to solve the problem!


i sort of have the same problem, but even when i did space, it still didn't accept it :frowning: (should i make a new topic about this??)



yes, you should make a new topic about this