Write a javascript program that format a number with commas.
const formatNumber = x => x ? x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : 0; console.log(formatNumber(50000000.99));