Convert a whole number amount of cents to a readable dollar amount in JavaScript?
Try dividing the number of cents by 100 to get the dollar equivalent. I.E.:
const number = 1629;
const dollars = (cents / 100).toLocaleString("en-US", {style:"currency", currency:"USD"});
dollars
now equals "$16.29"
Why not divide through 100 before toLocaleString?
var num = 1629; // this represents $16.29
num /= 100; // cent to dollar
num.toLocaleString("en-US", {style:"currency", currency:"USD"});