Hey everyone, I’m trying to see what is wrong with my code here. The task is to loop throughout the array and replace certain numbers with string.
Here is the code:
let integers = [];
for ( index = 0; index < 50; index++ ){
integers[index] = Math.round(Math.random()*50);
}
for (i = 0; i < integers.length; i++){
if (integers[i] == 4) {
integers[i] = 'Cat';
}
else if (integers[i] == 7) {
integers[i] = 'Fish';
}
}