我有以下内容:
function checkPalindrom(palindrom)
{
for( var i = palindrom.length; i > 0; i-- )
{
if( palindrom[i] = palindrom.charAt(palindrom.length)-1 )
{
document.write('the word is palindrome.');
}else{
document.write('the word is not palindrome!');
}
}
}
checkPalindrom('wordthatwillbechecked');
Run Code Online (Sandbox Code Playgroud)
我的代码出了什么问题?我想检查这个词是否是回文.
我想知道如何在javascript中编写回文,我输入不同的单词和程序显示单词是否是回文.例如,中午是回文,而坏则不是回文.
先感谢您.