Errata in excercise explanation


The explanation says: "[...]for instance, if the paragraph contains both "Eric" and "Eddie", we'll see this in our hits array:

but it will just give

since the second FOR will stop when it reaches the myName.length, which in case of "Eric", is 4. Hence it will show just the first 4 characters it finds.

If you try the code it will show it.

/*jshint multistr:true */

text = "Blah blah blah blah blah blah Eric \
blah blah blah Eddie blah blah Eric blah blah \
blah blah blah blah blah Eric";

var myName = "Eric";
var hits = [];

// Look for "E" in the text
for(var i = 0; i < text.length; i++) {
    if (text[i] === "E") {
        // If we find it, add characters up to
        // the length of my name to the array
        for(var j = i; j < (myName.length + i); j++) {

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


Thank you for reporting the problem, we recognise this is a bug, however as it does not prevent users from passing the lesson and this is one of the older courses it is unlikely this bug will be fixed. Thank you for taking the time to inform us though, we would like everything to be fixed just as much as you would!