I cannot understand why my word[1] returns an a instead of an i, could you help me understanding it?
var word = 'tangle';
document.write(word[1]); //returns 'a'
word[1] = 'i';
document.write(word[1]); //returns 'a'
(truth is, I wanted to make this, is my method wrong?)
//convert the first letter of each word of the string in upper case
var string = 'the quick brown fox';
stringSpl = string.split(' ');
for (var j=0; j<stringSpl.length; j++){
stringSpl[j][0] = stringSpl[j][0].toUpperCase(); //this line is the faulty one
}
document.write(stringSpl.join(' '));