โค้ดโปรแกรม
// Palindrome Problem
const isPalindrome = (s)=>{
const ch=s.split("")
const hf = Math.floor(s.length/2)
for(let i=0;i<hf;i++){
const lf = s.charAt(i)
const rt = ch.pop()
if(lf!=rt) return false
}
return true
}
// check
const a = "eerrtrree"
const b = "wwrrrrww"
const c = "wwabcww"
console.log(isPalindrome(a))
console.log(isPalindrome(b))
console.log(isPalindrome(c))