Infinite loops?!?!


#1

I wrote this code and made variation after variation but it only freezes up. Can I get some help please?

 /*jshint multistr:true */

var text = "Amun, put the socks over there, Amun.";
var myName ="Amun";
var hits = [];

for(i=0; i<text.length; i++){
    if(text[i] === "A"){
        for(j=i; j=i+myName.length; j++){
            hits.push(myName)
        }
    }
};

#2

Same issue. Can't figure out what would be causing the infinite loop here:

var text = "Some text goes in here. My name is Jeff. The computer told me to write my name \
a few times. Jeff Jeff Jeff Jeff Jeff. I bow to my robot overlords."

var myName = "Jeff"

var hits = []

for(var i = 0; i < text.length; i++) {
    if(text[i] === 'J') {
        for(var k = i; i < myName.length + i; k++) {
            hits.push(text[k]);
         }
    }
}

#3

Never mind. Found my issue. I think I've been staring at the screen too long. Didn't notice I had an i in the second loop that should be k (or j if you're using the same variables as it suggests). Looking at my code above with that change should answer your question.


#4

What computer language is this?