<html>
<head>
<script>
function foo()
{
var str = reverse('a,b,c,d,e,f,g');
alert(str);
if (str == 'g,f,e,d,c,b,a')
alert('成功');
else alert('失敗');
}
function reverse(str)
{
// 在此處加入代碼,完成字符串翻轉功能
// **********Found**********
var spl = str._____________(',');
var newstr="";
// **********Found**********
for(i=____________;i>=0;i--)
{
// **********Found**********
newstr+=____________+',';
}
// **********Found**********
newstr=newstr._____________(0,newstr.length-1)
return newstr;
}
</script>
</head>
<body>
<input type="button" value="str" onclick="foo()" />
</body>
</html>
答案
1. split
2. spl.length-1
3. spl[i]
4. substring
在食堂喫飯,妹妹問哥哥:“我想多喫一個雞腿!”
哥哥說:“你去向打飯阿姨賣個萌,她就給你!”
然後妹妹也沒多想就真的向阿姨賣了個萌,阿姨給她多加了一個雞腿。