Format numbers with separator
var n = 1234567890; String(n).replace(/(.)(?=(\d{3})+$)/g,'$1,') // "1,234,567,890" // Replace $1, with $1. or $1space to change separator