"Victory!"...but I never actually found my name. What's wrong with my code?



The exercise says "Congratulations! You've finished the course!" but the output of my code in the top right says "Your name wasn't found!"

I don't really care that the exercise thinks I'm done. I want to know how to fix my code so that it finds the name I specified. Can anyone anyone help me identify where I'm going wrong?

/*jshint multistr:true */

var text = "This is just a test, Rob.";

var myName = "Rob";

var hits = [];

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

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


Remove the semi-colon. There is no semi-colon in the structure of a for loop (or an if statement).

for (...) {
    if (...) {



Wow, I can't believe I missed that. Thank you so much!!


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