I need to show 2 decimals place after the total amount of payment.
I have tried this way:
cart.itemsPrice = cart.cartItems.reduce(
(acc, item) => acc + (item.price * item.qty).toFixed(2),
0
);
then output show me like this:
$0269.97179.9888.99
I don't konw why,
then If I try to like this:
cart.itemsPrice = cart.cartItems.reduce(
(acc, item) => acc + Math.round(item.price * item.qty).toFixed(2),
0
);
then still I got the same garbage value
Any Suggestion please.