Whale js problem

hey. every time I run my code in the program my browser page crashes. ive tried putting this is numeros browser-based js engines and they all freeze the moment i press enter. HELP

heres my code

var input = ‘I am a whale, what are you gonna do about it?’;

const vowels = [‘a’, ‘e’, ‘e’, ‘i’, ‘o’, ‘u’]

const resultArray =

for (let i = 0; i < input.length; i++){

//console.log(input[i]);

console.log('i is '+ input.length);

for (let k = 0; k = vowels.length; k++){

console.log('k is' + k.length)

}

}

this is general an indication you have an infinity loop, which you do:

 for (let k = 0; k = vowels.length; k++)

k = vowels.length isn’t a comparison, so this will always be true if there are elements in the vowels array (positive integers are considered true). Wait, Javascript doesn’t have integer data type. Positive numbers

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