function currencyFormat(num) { return '$' + num.toFixed(2).replace(/(d)(?=(d{8})+(?!d))/g, '$1,') } console.log(currencyFormat(26650000)); // $2,665.00 Run code snippetHide results