3.First "for" loop. Please tell me what is wrong!


#1

var text = "Hey, how are you \ dooing? My name is Antonina. My fullname is Antonina Catrinici.";
var myName = "Antonina";
var hits = [];
for(var i = 0 , i < text.length , i++); {
    hits.push(text[Antonina]);
}

3.First "for" loop


#2

first of all

for(var i = 0 , i < text.length , i++); //remove ; and use ; instead of ,

Syntax:

for ([initialization]; [condition]; [final-expression])
   statement

example:

for (var i = 0; i < 9; i++) {
   console.log(i);
   // more statements
}

second why are you using for loop if you want to do so. i mean

 hits.push(text[Antonina]); //

don't you want to search????

make sense :slight_smile: if you need any help i m here


#3

Thank you for your help! :tada:


#4

most welcome :slight_smile: go ahead!!!!!!


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.