Palíndromo Checker

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

function palindrome(str) {
  str.replace(/\s{2,}/g," ");
return true;
returne false;

  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36

Challenge: Palindrome Checker

Link to the challenge:

First, you’ve got a typo here, and second, you can’t have a return statement outside of a function, so get rid of this line.

String methods like replace return a new string, so you have to capture the returned string in a variable.

Don’t worry about trying to get tricky here or making your code concise. Start by just doing one thing at a time. You want to ignore punctuation, case and spacing, so you’ll want to convert the string passed into the function to all lower case, remove any space characters, and remove any punctuation (anything that is not a letter or number). After you have done this then you can create a reversed copy of it and compare it to the original to see if it is a palindrome. That will tell you whether you return true or false.

obrigado pelas dicas. fiquei a tarde toda tentando . …

Oi, @lindomarolimpio . Movi seu tópico pro português. Espero que não se importe. Resolveu a função? Um abraço.

Sim obrigado. Mas parece tudo tão difícil. Minha cabeça está em bug. Pareço perdido… Não sei se vou conseguir… Vou pedindo ajuda e pesquisando sobre o que tem de ser feito…

Tranquilo. É para isso que estamos por aqui. :slight_smile: Abraço!

Yes, javascript can be confusing at first, but keep trying. Concentrate on doing just one thing at a time. Start with converting the string passed into the function to all lower case. Do you know how to do that?