File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -64,9 +64,9 @@ console.log(total.toFixed(2));
6464Let'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
7171let amountInEur = exchangeRateUsdToEur .multiply (amountInUsd);
7272console .log (amountInEur .round (2 ).toString ());
@@ -76,8 +76,8 @@ Here's the same example, this time using `Decimal.Amount`
7676and ` 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" );
8181let exchangeRateUsdToEur = new Decimal (1 ).divide (exchangeRateEurToUsd);
8282let amountInEur = exchangeRateUsdToEur .multiply (amountInUsd);
8383let opts = { style: " currency" , currency: " EUR" };
You can’t perform that action at this time.
0 commit comments