#Heloo!<br>
var input = prompt();
var binput = input.split("");
var inputl = input.split(" ").length
if ( inputl % 5 == 0 ){
binput.forEach(function(v, i) {
if(v === "a") {
binput[i] = "$"
}}}
my problem here is that i want only the 5th 10th 15th... element of inputl to be changed and now it changes the whole text if (inputl % 5 == 0). However i only want to grab the fifth element of inputl's array
my apologies for the "br" commands
Aucun commentaire:
Enregistrer un commentaire