Hello everyone!
Can someone,please, explain, how the computer reads the commands step by step in this task:
function palindrome(str) {
var string = “”;
string = str.toLowerCase().replace(/[^A-Za-z0-9]/g,’’).split("").reverse().join("");
if (string === str.toLowerCase().replace(/[^A-Za-z0-9]/g, ‘’)) {
return true;
}
else if (string != str) {
return false;
}
}
palindrome(“zooz”);