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

240
Views
javacsript error No se pueden leer las propiedades de undefined (leyendo 'createItemMarkup') en .forEach

Tengo una clase muy simple,

 class LocationSearch extends BaseComponent { constructor(element) { super(element); this.initializeSearch(); } initializeSearch() { this.service = new window.google.maps.places.AutocompleteService(); this.service.getPlacePredictions({ input: 'The Black Bull' }, this.displayResults); } displayResults(predictions, status) { if(status !== window.google.maps.places.PlacesServiceStatus.OK) { this.searchResults = []; return false; } const results = predictions.map((prediction) => prediction.structured_formatting); const resultsWrapper = SelectorEngine.findOne('.location-search-results-list'); results.forEach((result) => { const item = this.createItemMarkup(result); resultsWrapper.append(item); }); } createItemMarkup(item) { const { main_text, secondary_text} = item; const listElement = document.createElement('li'); const buttonElement = document.createElement('button'); const firstLine = document.createTextNode(main_text); const lineBreak = document.createElement('br'); const secondLine = document.createTextNode(secondary_text); buttonElement.setAttribute('class', 'location-search-results-list__item'); buttonElement.setAttribute('type', 'button'); buttonElement.setAttribute('role', 'option'); buttonElement.append(firstLine) .append(lineBreak) .append(secondLine); listElement.append(buttonElement); return listElement; } }

Al ingresar la parte forEach del método displayResults , aparece el siguiente error:

No se pueden leer las propiedades de undefined (leyendo 'createItemMarkup')

No puedo entender lo que está pasando para que sea indefinido?

about 4 years ago · Santiago Gelvez
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!