Use number format browser API
This commit is contained in:
parent
3d92aaf8c4
commit
54b316d7b2
2
game.js
2
game.js
@ -39,7 +39,7 @@ function updateLayout() {
|
||||
currentCpu = getRandomCpu();
|
||||
document.getElementById("currentCpuTitle").innerText = currentCpu.name;
|
||||
// add "." to large numbers
|
||||
document.getElementById("currentCpuScore").innerText = currentCpu.score.toString().length > 3 ? currentCpu.score.toString().slice(0, currentCpu.score.toString().length - 3) + "." + currentCpu.score.toString().slice(currentCpu.score.toString().length - 3) : currentCpu.score;
|
||||
document.getElementById("currentCpuScore").innerText = new Intl.NumberFormat().format(currentCpu.score)
|
||||
nextCpu = getRandomCpu();
|
||||
document.getElementById("nextCpuTitle").innerText = nextCpu.name;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user