Web/javascript

콤마 형태의 숫자를 정수형으로 바꾸기

rockettttman 2021. 4. 28. 13:26

아래와 같이 콤마가 포함된 형식의 숫자를 정수형으로 변환할 수 있다.

var num = "999,999"

function invertNum(num) {
	return parseInt(num.replace(/,/g , ''));
}

'Web > javascript' 카테고리의 다른 글

javascript - strict mode  (0) 2021.07.16
querySelector와 querySelectAll  (0) 2021.05.10
javascript Number > prototype> Method > toLocaleString()  (0) 2021.04.28
Array - map과 reduce  (0) 2021.02.02
$(document).ready, $(window).load  (0) 2021.01.28