I have a Magento store where I need to remove a whitespace from a number so I can use it later on for dividing the price and stuff.

The code is as simple as this:

```
<script>
var newprice = <?php echo $newprice;?>
document.write(newprice);
</script>

```

If the price is less than 1000 (three numbers), it outputs correctly. If the price is four numbers, it wont output at all. Though I can see from the source code that the variable is stored correctly, example:

```
var newprice = 1 089

```

What I need is to remove this whitespace, but it doesnt seem to be that easy. I have tried:

```
var newprice = "<?php echo $newprice;?>" // with quotes
document.write(parseInt(newprice));

```

This outputs only "1". I have also tried the following code, but it outputs 1 089 (with whitespace):

```
document.write(newprice.replace(" ", ""));

```

Any ideas?