Hi,
For one I am not quite sure why dev.console is not discussed earlier in the lessons. Everyone needs to know ‘some sort of ‘debug system’’. But my ‘reverse’ code just doesn’t seem to be working. I am wondering ‘why not’, or what I am ‘missing’. I could of course just ‘brute force’ it into another array via a for/loop in reverse order, but that defeats the point of learning these ‘high level’ commands.
I think I have the ‘selection’ code worked out via one way or another, but if it doesn’t reverse I am ‘stuck’.
Your code so far
function palindrome(str) {
// Good luck!
lowerCaseStr = str.toLowerCase();
lowerCaseStr = lowerCaseStr.replace(/\W/gi,'').replace(/_/g,'');
var originalStr = lowerCaseStr.split('');
var reverseStr = originalStr;
reverseStr.reverse();
console.log(originalStr);
console.log(reverseStr);
}
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: