trying to convert a letter to uppercase using .toUpperCase()… doesn't work?

后端 未结 2 1058
轮回少年
轮回少年 2021-01-28 08:47

I\'m trying to convert a character in an array to uppercase using .toUpperCase(), but it doesn\'t work. I\'m pretty sure my logic is correct, so not sure why it\'s not working?<

2条回答
  •  忘掉有多难
    2021-01-28 09:35

    console.log(tempArr[i]); //this will display "i" and "p".. why?

    because you were not storing the converted value back to the variable

    make it

    tempArr[i] = tempArr[i].toUpperCase();
    

提交回复
热议问题