JavaScript project logical error

My Algorithm for this challenge

  1. delete all non-alphanumeric characters
  2. parse the resulting string to lowercase
  3. copy string in reverse format, compare with string from step 2, if both are identical, return true.

My code keep returning this

palindrome("0_0 (: /-\ :) 0-0")

should return true.

My code so far


function palindrome(str) {
//CODE BLOCK II |filter characters
for (let cnt = 0; cnt < str.length; cnt++) {
 //def regex to test presence of  non-alphanumeric characters, replace with void ''
 if (/\W+/.test(str[cnt]) == true) {
  str = str.replace(str[cnt], '');
 }
 //def regex to test presence of  space characters, replace with void ''
 if (/\s/.test(str[cnt]) == true) {
  str = str.replace(str[cnt], '');
 }
 //reject underscores
 if (/_/.test(str[cnt]) == true) {
  str = str.replace(str[cnt], '');
 }
}
//CODE BLOCK II | parse characters to same case
str = str.toLowerCase();
//loop to check characters form index 0
let cnt;
let cntIArr = [];
let cntJArr = [];
//loop to check characters form last index
for (cnt = 0; cnt < str.length; cnt++) {
 cntIArr.push(str[cnt]);
 cntJArr.unshift(str[cnt]);
}
//CODE BLOCK III | comparison
let iArr = '';
let jArr = '';
for (let cnt = 0; cnt < str.length; cnt++) {
 //merge string
 jArr += cntJArr[cnt];
 iArr += cntIArr[cnt];
}
return (iArr === jArr) ?
 true : false;
}

Challenge: Palindrome Checker

Link to the challenge:

this you could substitute with a reverse character class. remember that if you write [^aeiou] thus match anything that is not a vowel, and you could use this to remove the not alphanumerical characters

you don’t need to make the arrays if you are creating strings in this way

add also console.log(iArr, jArr) to see if the values of those two strings is what you expect