You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionpigIt(str){returnstr.split(' ').map(function(v){returnv.slice(1).split('').join('')+v[0]+'py'}).join(' ');}// 测试用例console.log(pigIt('Pig latin is cool'));//igPay atinlay siay oolcay
functionpigIt(str){returnstr.split(" ").map(function(v){returnv.trim().substr(1)+v.trim()[0]+"ay";}).join(" ");}console.log(pigIt('Pig latin is cool'));//igPay atinlay siay oolcay
每个首字母位移到单词末位,然后在每个单词末尾添上ay
PS:只能添加一行代码
The text was updated successfully, but these errors were encountered: