var str = 'abccba';
function checkPalindrome(str) {
var originStr = str;
var reverseStr = str.toLowerCase().split("").reverse().join("");
if (originStr === reverseStr) {
var palindrome = document.createElement('li');
palindrome.innerHTML = str;
list.appendChild(palindrome);
originStr.slice(1, -1);
}
}
var str = 'abccba';
function checkPalindrome(str) {
var originStr = str;
var reverseStr = str.toLowerCase().split("").reverse().join("");
if (originStr === reverseStr) {
var palindrome = document.createElement('li');
palindrome.innerHTML = str;
list.appendChild(palindrome);
return originStr.slice(1, -1);
}
return originStr;
}
str = checkPalindrome(str)