Tell us what’s happening:
Your code so far
function palindrome(str) {
// Good luck!
str = str.toLowerCase().replace(/[\W_]/g, '');
for(var i = 0, len = str.length - 1; i < len-i; i++) {
if(str[i] !== str[len-i]) {
return false;
}
}
return true;
}
palindrome("not a palindrome");
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36
.
Link to the challenge: