séparador de miles javascript

function format (num) {
		    var reg=/\d{1,3}(?=(\d{3})+$)/g; 
		    return (num + '').replace(reg, '$&,');
		}
Splendid Skunk