Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!