📅  最后修改于: 2022-03-11 15:02:21.386000             🧑  作者: Mango
function insertHyphen(str) {
var strArr = str.split('');
var numArr = strArr.map(Number);
for(var i = 0; i < numArr.length; i++) {
if(numArr[i-1]%2===0 && numArr[i]%2===0) {
numArr.push('-');
}
}
return numArr.join('');
}
insertHyphen('112233445566'); // 112233445566---