<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
No error and I’m done with the lesson but I’d like to know how to get rid of the repeating of my name in the log.
[spoiler]
```
/*jshint multistr:true */
var text = “Hey, how are you
doing? My name is Kyle. Kyle enjoys coding, but more importently, Kyle likes talking in third person.”;
var myName = “Kyle”;
var hits = ;
for (var i = 0; i < text.length; i++) {
if (text[i] === “K”) {
for (var j = i; j < i + myName.length; j++) {
hits.push(text[j]);
}
}
}
if (hits === 0) {
console.log( “Your name wasn’t found!”);
} else {
console.log(hits);
}
[/spoiler]
<do not remove the three backticks above>
why would you want this? The design of the program is in such a way, that it find all instance of myName in text
If you only want your name once, you can simply remove the second for loop and instead push myName to hits array and then break the loop, then you have your name once
or you can break the loop first for loop after the second for loop has finished.
Sorry I read the last part of the lesson wrong. It asks how can I have the console log ONLY my name, even if there is a word that starts with a K in var text?