12/13


#1
// Click on "Stuck? Get a hint!" if you get stuck!
var names =["Bob", "Jessica", "angeline", "Antonio", "Jaiel", "sally", "linxy"];
for(var i=0; i<names.length; i++){
    console.log("I know someone called " +" " + names[i]);
}

i am getting the error message "Oops, try again. It looks like there aren't exactly five names in the names array" any suggestions?


#2

i tried refreshing the page and resetting the code and the code prints out all 7 names


#3

Well there are obviously more then 5 names in your names array (7) but I guess the more crucial part is where you wrote your for loop. I guess there went something missing.

PS: ok fixed your formatting and your loop seems to be ok again. Maybe just try it with only 5 names.


#4

ok thanks and i did that and now im getting another error message "Oops, try again. Your code should have printed 'I know someone called Bob', 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!" and i copied and pasted that part from the instructions


#5

nvm i had an extra space at the end of called, thanks


#6

maybe you need to space out your equal sign form your parenthesis thing it looks like this **[ ] :grin:


#7

You need to delete two names from your list as well if you do that then they should tell you this

Oops, try again. Your code should have printed 'I know someone called Bob', 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!

hope that helps as well!!! :stuck_out_tongue: :grin: :stuck_out_tongue_winking_eye:


#8

I am having the same issue with the reply: Oops, try again. Your code should have printed 'I know someone called Ali', 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 have only 5 names. I even copied a correct code from another person but still same issue. my code is:
var names = ["Ali", "Naaman", "Mike", "Clint", "Adrian"];

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

}


#9

All that you need to do is put a space after "called".


#10

I thank you for the assistance but it still does not work. Same message. I will continue.


#11

Hey I finally got code to work:
var names = ["Ali", "Naaman", "Mike", "Clint", "Adrian"];

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

}

I needed empty quotes between Called & Names. If you use the "+" alone the words will be joined together (Concatenated).


#12

thanks for the code it helped alot


#13

I always get this error.


#14

Thanks! And cool icon!


#15

console.log ("I know someone called " + names[i]); //[i] prints out all 5 names
// use only 5 names!