string.replace(searchValue, replaceValue)
var result ="mother_in_low".replace("_", "-"); result // "mother-in_low"
“mother-in_low” 처럼 실망스런 결과가 나온다.
searchValue 가 정규표현식이고 g 플래그가 설정된 경우라면 일치하는 모든 부분이 교체 됩니다.
var result ="mother_in_low".replace(/_/g, "-"); result // "mother-in-low"
Total Views: 3460 ,