diff --git a/dice-game-webapp/src/Main.hx b/dice-game-webapp/src/Main.hx index ae96298..d217a70 100644 --- a/dice-game-webapp/src/Main.hx +++ b/dice-game-webapp/src/Main.hx @@ -1,3 +1,4 @@ +import js.lib.intl.NumberFormat; import js.Browser; import js.html.*; @@ -16,10 +17,10 @@ class Main { sum += dice[i]; // add die value to sum var newDice:js.html.DivElement = cast(Browser.document.createElement("div"), js.html.DivElement); newDice.id = 'dice-${i + 1}'; // set id to dice-number to make id's unique - newDice.textContent = 'Dice ${i + 1}: ${dice[i]}'; // set text to each die value + newDice.textContent = 'Dice ${new NumberFormat().format(i + 1)}: ${dice[i]}'; // set text to each die value appContent.appendChild(newDice); // append dice values to app content } - appContent.innerHTML += '\nSum of dice: ${sum}'; // print sum of all dice and append to app content + appContent.innerHTML += '\nSum of dice: ${new NumberFormat().format(sum)}'; // print sum of all dice and append to app content } } }