// Q. Write a function that checks if a given string (case insensitive) is a palindrome.
function isPalindrome(x) {
x = x.toLowerCase();
for(let i = 0, j = x.length - 1; i < x.length; ++i, --j){
if(x[i] != x[j]){
return false
}
}
return true;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter