1function palindrome(str) {
2 var re = /[\W_]/g;
3 var lowRegStr = str.toLowerCase().replace(re, '');
4 var reverseStr = lowRegStr.split('').reverse().join('');
5 return reverseStr === lowRegStr;
6}
7palindrome("A man, a plan, a canal. Panama");