203k views
4 votes
Develop an algorithm and draw a flowchart to determine and input number is palindrome or not.​

User Bably
by
4.5k points

1 Answer

1 vote

function checkPalindrome(str){
let reversed = str.split("").reverse().join("")
return str === reversed
}
let str1 = "anna"
let str2 = "banana"
let str3 = "kayak"
checkPalindrome(str1)
// -> true
checkPalindrome(str2)
// -> false
checkPalindrome(str3)
// -> true
User MikeM
by
4.2k points