Tell us what’s happening:
I got this code to work but wondering if it is sutiable as it was different from all the given solutions
Your code so far
function palindrome(str) {
// Good luck!
var y = str.toLowerCase('').replace(/[^a-zA-Z0-9]/g,'');
var x = str.split('').reverse('').join('').toLowerCase('').replace(/[^a-zA-Z0-9]/g,'');
if (x === y){
return true;
}
else {
return false;
}
}
palindrome("race car");
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36
.
Link to the challenge: