const isPalindrome = str => {
let result = true;
let left = 0;
let right = str.length - 1;
const is = (ch) => /[a-z0-9]/i.test(ch)
 
while (left < right) {
console.log(left, right);
// if (!is(str[left])) left++
// if (!is(str[right])) right -= 1
console.log(`${left} ->`,str[left], `|| ${right} ->`, str[right]);
left++;
right -= 1;
}
 
return result;
};
 
isPalindrome('A man, a plan, a canal: Panama');
 
Code will run automatically after changes.
Code runs in an isolated environment.