Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

165
Visualizações
did i mix up the function names with id's i got this errorTypeError: c.includes is not a function

On CodePen, I'm trying to filter out the restaurants that start with the letter 'c' but I got an error that says 'errorTypeError: c.includes is not a function' but I already checked spelling and see if they're named the same as the ID. am I supposed to put the callback function in the 'result.forEach(restaurant => { cList += \n${restaurant.name}; });' line, or is it something else?

https://codepen.io/tizum5/pen/qBXVmLb?editors=0011

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

c is a restaurant, i.e. an object of the form { name, takeout, rating }. It doesn't have a method includes.

Most likely, you intended to call includes on the string property name: c.name.includes('c').

Note that your code says "Restaurants that start with a C" but that's not what this code would do even after the fix - it would look for restaurants whose names have a lower-case c anywhere in the name. I guess you rather want something like c.name.startsWith('C') or even c.name.match(/^c/i) in case it should allow both lower- and upper-case C.

You would have noticed that if you had debugged your code. Please familiarize yourself with how to debug JavaScript using the browser devtools to be able to identify and solve such issues yourself next time.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda