我正在尝试使用'innerHTML'打印出我的结果>
if (userChoice === computerChoice) { console.log("Tie!"); result_h3.innerHTML = userChoice + " and " + computerChoice + " are both the same. It's a draw!";
如何使userChoice变量的首字母在浏览器中大写?
我尝试过:
if (userChoice === computerChoice) { console.log("Tie!"); result_h3.innerHTML = userChoice.value.charAt(0).toUpperCase() + userChoice.value.slice(1).toLowerCase() + +" and " + computerChoice + " are both the same. It's a draw!";
没有用。
我正在尝试使用'innerHTML'打印我的结果,如果(userChoice === computerChoice){console.log(“ Tie!”); result_h3.innerHTML = userChoice +“和” + computerChoice + ...
这对我有用: