12. Loops and arrays II


#1



https://www.codecademy.com/en/courses/javascript-beginner-en-NhsaT/2/4?curriculum_id=506324b3a7dffd00020bf661#


SyntaxError: missing ) after argument list
Oops, try again. There was a problem with your syntax.


var names = ["Qasim", "Hamad", "Fahad", "Usmaan", "Adnaan"]; 
for (var i = 0; i < someNum; i ++)  {
    console.log("I know someone called" names[i]); 
}


#2

Hi this line

for (var i = 0; i < someNum; i ++)

where you put somNum you should put names.length
then here

console.log("I know someone called" names[i]);

add the + before names[i] and then put a space before the closing " like that

console.log("I know someone called " +..

#3

Thanks man, it works now.,


#4

Have you really understand what he tell you ?
The + sign will allow you to Addition two Numeric value or Concatenate two variables, one of them containing String.
array.length permit you to get the total length of the array, so you can iterate between 0 and the last index which is array.length - 1.
for (var i = 0; i < array.length; i++) or for (var i = 0; i <= array.length - 1; i++) to be more precise.