vendredi 30 mars 2018

Counter variable not increasing inside of if statement

I have a function that is suppose to capitalize the first letter of the next word. "this is a! Test." is the desired result.

var splitUp = ["this", "is", "a!", "test."];

I increment the variable inside the "for loop" only if the "if" statement runs.

if (punctuation.indexOf(translationString[iii]) != -1) {
  console.log(iii+ ": " +translationString[iii]);
  console.log("iii is on: " + iii);
  iii + 2;
  console.log("after increment, iii is on: " + iii);
  translationString[iii].toUpperCase();
}

I can not figure out the reason the value of "iii" is not increasing. Is there a work around or am I missing something entirely?

JSFiddle

Aucun commentaire:

Enregistrer un commentaire