Check for Palindromes help?

Tell us what’s happening:
I don’t understand why this code is not working. Any help would be appreciated.

Your code so far

function palindrome(str) {
  // Good luck!
  var array = [];
  var str1 , str2;
  str1 = str.replace(/[\W_]/g,"");
  str2 = str1.toLowerCase();
  array = str.split('');
  for(var i=0;i<array.length/2;i++){
      return false;
  return true;


Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36.

Link to the challenge:

Hint: Why did you create str2 if you are not going to use it?

1 Like

A stupid mistake. Thank you.