Skip to content

Commit bde7468

Browse files
authored
Use strings rather than numbers (#201)
1 parent 0a46f0a commit bde7468

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ console.log(total.toFixed(2));
6464
Let's convert USD to EUR, given the exchange rate EUR --> USD.
6565

6666
```js
67-
let exchangeRateEurToUsd = new Decimal(1.09);
68-
let amountInUsd = new Decimal(450.27);
69-
let exchangeRateUsdToEur = new Decimal(1).divide(exchangeRateEurToUsd);
67+
let exchangeRateEurToUsd = new Decimal("1.09");
68+
let amountInUsd = new Decimal("450.27");
69+
let exchangeRateUsdToEur = new Decimal("1").divide(exchangeRateEurToUsd);
7070

7171
let amountInEur = exchangeRateUsdToEur.multiply(amountInUsd);
7272
console.log(amountInEur.round(2).toString());
@@ -76,8 +76,8 @@ Here's the same example, this time using `Decimal.Amount`
7676
and `Intl.NumberFormat` to properly handle currency:
7777

7878
```js
79-
let exchangeRateEurToUsd = new Decimal(1.09);
80-
let amountInUsd = new Decimal(450.27);
79+
let exchangeRateEurToUsd = new Decimal("1.09");
80+
let amountInUsd = new Decimal("450.27");
8181
let exchangeRateUsdToEur = new Decimal(1).divide(exchangeRateEurToUsd);
8282
let amountInEur = exchangeRateUsdToEur.multiply(amountInUsd);
8383
let opts = { style: "currency", currency: "EUR" };

0 commit comments

Comments
 (0)