ay
the
从两个辅音开始,h在第二次迭代中被推到末尾。
str = "the extra quick brown fox"
if (str.match(/[ ]/)) {
str = str.split(" ");
for (let i = 0; i < str.length; i++) {
for (let j = 0; j < str.length; j++) {
if (str[j].match(/^[q][u]/)) str[j] = str[j]
.substring(2) + str[j].slice(0, 2);
if (str[j].match(/^[^aeiou]/)) {
str[j] = str[j].substring(1) + str[j].substring(0,1);
}
}
console.log(str[i])
str[i] = str[i] + 'ay';
console.log(str)
}
str = str.join(" ");
}
VM383:12 het
// Notice it is correct with the first pass.
VM383:15 (5)Â ["hetay", "extra", "ickqu", "rownb", "oxf"]
VM383:12 extra
// but it is incorrect after the second.
VM383:15 (5)Â ["etayh", "extraay", "ickqu", "ownbr", "oxf"]