Log it!


I don't know what is going on but my code keeps printing out "Your name wasn't found!" here is my code:
/*jshint multistr:true */

var text = "Nathan is nice and his name \ is Lee do you know where Nathan is?";
var myName = "Nathan";
var hits = [];

for (var i = 0; i < text.length; i++) {
if(text[i] === myName[0])
for(var j = i; j < myName.length + i; j++) {

if(hits !== "N"){
console.log("Your name wasn't found!")
else {

Can anyone help?


Remember, you need semi colons after the console.logs. :smiley:


Thanks but that doesn't really help my problem.


Okay.... Look at this now:

You see, you need brackets after the if statement.

Also, at the end, you're supposed to see if the hits.length is equal to 0. Not:


Thanks it worked wonders!