Tue Dec 07 2021 12:21:44 GMT+0000 (Coordinated Universal Time)
Saved by @TheInspired
const formattedAmount = parseInt(transactionInfo?.data.amount) .toFixed(2) .replace(/\d(?=(\d{3})+\.)/g, "$&,"); // Only parse if number comes as string initially OR (2501500).toLocaleString("en-US", { style: "currency", currency: "USD", })
Copy this HTML code:
Preview:
open_in_newInstructions on embedding in Medium
Comments