An array is given:
var fruits = ["banana", "cherry", "melon", "strawberry"]; It is necessary to iterate it using the while loop and for all values with an even index, change the register to the upper one.
Wrote the following code:
var i; while (i < fruits.length - 1) { if (fruits[i] % 2 === 0) { fruits[i].toUpperCase(''); } else { continue; } i++; } What am I doing wrong?
fruits[i].toUpperCase('');not assigned anywhere. It is necessary sofruits[i]=fruits[i].toUpperCase('');- Stepan Kasyanenko