I'm trying to make some sort of cryptographer, and I need to replace for ex. every "a" with "b" when the user asks for it.
if (DoYouWannaCrypt == 1) {
binput.forEach(function(v, i) {
if(v === "a") {
input[i] = "$"
}
})
};
This works fine, however I want to add another condition that this should only be done for all 5th values of another array.
if (Val is 5th) {
if (DoYouWannaCrypt == 1){
binput.forEach(function(v, i) {
if(v === "a") {
input[i] = "$"
}
})
}
};
I think you can see where I'm stuck at. I need it to work for all 5th values not just the first one.
<br>as new lines. Use the markdown to style your post.Val? Ifbinputis your array, yourifis in the wrong place.(Val is 5th)and we can't see it. Maybe you should post a fiddle