I found a solution on how to write palindrome in StackOverFlow. This is the code snippet:
function palindrome(str) {
var len = str.length;
for ( var i = 0; i < Math.floor(len/2); i++ ) {
if (str[i] !== str[len - 1 - i]) { //Problem in this line
return false;
}
}
return true;
}
I understand every line except the one I have here. Can anyone please break it down for me? Thanks in advance!