Tell us what’s happening:
How do I test the string to check the palindrome? so far I have removed the non alpha numeric digits.
i’ve tried if/else statements but they do not seem to work(or I havent figured it out). Any ideas? im trying to come up with my own solution. ive looked at other solutions to help form my own(dont know if thats a great idea or not).
Your code so far
function palindrome(str) {
// Good luck!
// first 3 variables set up lowercase, removal of non alpha nums, and concatenation of low + alpha in var con
var alpha = str.replace(/[\W_]/g,'');
var low = alpha.toLowerCase();
var con = low.concat(alpha);
// splitting reversing and joining
var splitting = str.split('').reverse('').join('');
// concatenation of var splitting and var con
var con_2 = splitting.concat(con);
return str;
}
palindrome("eye");
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
.
Link to the challenge: