Newbie here, and I've been playing around with this setInterval() count up timer, and my goal here is to get the counter to display thousands (,) separators while counting up. Is there an easy way to do this, or would it require a difficult solution? I've tried to play around with toLocaleString, but to no avail. Here's my code so far.
<p id="test">0</p>
<button id="button" onclick="b().toLocaleString('en-US')">Start</button>
<script>
var c = 0;
function a() {
document.getElementById("test").innerHTML = ++c;
}
function b() {
setInterval(a, 5);
}
</script>