Somebody help me on 5/7 PLZ!


This is my exact code and I don't have any idea what I'm doing wrong. Please help me!!!
/*jshint multistr:true */
var text = "fslkajleifj Cierra cflkjfiafl fishaaj geaikajf dgkajliw vliigjs Cierra coihasfihlikokkklkkkkf alfisisehri Cierra soifjelfia, hlushfl Cierra";
var myName = "Cierra";
var hits = [];
for(var i = 0; i < text.length; i++){
if(text[i] === 'C'){
for(var j = i; i < myName.length + i; j++){
hits.push[text j]


Look at your second "for" loop. What is "i < myName.length + i; j++"? In place of the "i", you must put the "j" to make it function.

Hope it helped!:smiley:


You have 2 problems
-1 the condition in your FOR-loop should be
j < myName.length + i;
-2 and the push()-method requires the syntax
hits.push( text[j] );


google search
javascript push array

javascript push array


Right. Forgot the other one. :sweat_smile:


Thank you so much. I never would have figured it out on my own. The people here are so helpful... Thanks again. :smile: