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", })
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter