function insertStr(soure, firstPosition, firstStr, secondPosition, secondStr) { soure = soure.slice(0, firstPosition) + firstStr + soure.slice(firstPosition) return soure.slice(0, secondPosition) + secondStr + soure.slice(secondPosition) } let currentTime = 20210107 consolog(insertStr(currentTime, 4, '-', 7, '-')) // 输出 2021-01-07