I have two functions here. One that adds a "," for separating thousands, like 1234 -> 1 234. And one function for increasing.

The function for increasing is just printing 123456 and I would like to combine these, I though I could just change:

$this.html(++current);

to:
$this.html(addSpaces(++current));

But it's not working. Please help me, how can I fix this?

```
function addSpaces(nStr)
{
    nStr += "";
    x = nStr.split(".");
    x1 = x[0];
    x2 = x.length > 1 ? "." + x[1] : "";
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) {
        x1 = x1.replace(rgx, "$1" + " " + "$2");
    }
    return x1 + x2;
}   

function count($this) {

    var current = parseInt($this.html(), 10);
    current = current + 13 /* This is increment */

    $this.html(++current);
    if (current > $this.data("count")) {
        $this.html($this.data("count"));
    } else {
        setTimeout(function() { count($this); }, 100);
    }

}

```