Generation

generate functionMon, 19 Dec 2022

function that returns the value of a number like 6k will be 6000

function thousands_with_commas(x) { var parts = x.toString().split("."); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); return parts.join("."); } thousands_with_commas(1000);

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant