10 進数値をフォーマットするタスクがあります。テキスト ボックスがあります。ユーザーはさまざまな値を入力できます。これを動的に行うにはどうすればよいですか?
function ReplaceNumberWithCommas(yourNumber) {
//Seperates the components of the number
var components = yourNumber.toString().split(".");
//Comma-fies the first part
components [0] = components [0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}