From 54b316d7b23290e41998f912d373358acdeb427d Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Wed, 12 Apr 2023 12:41:25 +0200 Subject: [PATCH] Use number format browser API --- game.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game.js b/game.js index b2734af..af8e2c7 100644 --- a/game.js +++ b/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; }