let str = 2022/1/1 let strNew = str.replace(new RegExp("/", "g"), ".") console.log(strNew) // 2022.1.1