「javaScript」String.prototype.replace()で全置換をするサンプル
JSコード
const str = “tokyo,oosaka,fukuoka,yokohama";
const replaced =str.replace(/,/g,’ ')
console.log(replaced)
結果
tokyo oosaka fukuoka yokohama
Coding Changes the World
JSコード
const str = “tokyo,oosaka,fukuoka,yokohama";
const replaced =str.replace(/,/g,’ ')
console.log(replaced)
結果
tokyo oosaka fukuoka yokohama