A palindrome is a word, sentence, or even number that reads the same from the back and from the front. Therefore if we take the input, reverse the string and check if the reversed string and the original string are equal, it means the string is a palindrome, otherwise, it is not.
We first convert the string to lowercase.
Then we split the string into an array using the split() method so that it can be reversed using the reverse() method.
We then join the array back to a string using the join() method.
Lastly, we check that the input string and the reversed string are equal or not. We will update the output accordingly.
Please Login to comment...