[javascript]
/**
* Format a number to display thousands like in the US -> 1000000 => 1,000,000
* @param number
* @returns
*/
function formatThousands(number) {
return Math.max(0, number).toFixed(0).replace(/(?=(?:d{3})+$)(?!^)/g, ‘,’);
}
[/javascript]