Second loop not pushing to the hits array


getting the error Oops, try again. It looks like your second 'for' loop isn't pushing values to the hits array. Make sure it's working properly and that myName's text appears somewhere in the text variable. and have been unable to figure out whats wrong with my code, any help on this would be appreciated

/*jshint multistr:true */
var text = "Clinton textetgowsjhfdsohfodsij odsif nodsifh dsofdsoifdosfih  Clinton Djhfisfhoiah";

var myName = "Clinton";

var hits = [];

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


Reverse the operator to less than, < so the condition is true, some of the time.


this crashes the page, which I presume means its infinite?


Good. We're on to the next problem. After the condition, did you increment j or i? It should be j.


ahh, thank you. legend


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