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

209
Views
usando una API falsa de jsonpalceholder, cómo agregar los datos devueltos de api a una lista - javascript

Estoy usando la API con javascript por primera vez, así que estoy usando la API falsa de jsonplaceholder.

Tengo una matriz de objetos y estoy tratando de iterar sobre una propiedad en esta matriz de objetos, pero recibí este error:

 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'appendChild')

Aquí está mi código

 const api_url = 'https://jsonplaceholder.typicode.com/users'; let specialisty = document.getElementById('specialisty-menu'); async function getUser() { // Making an API call (request) // and getting the response back const response = await fetch(api_url); // Parsing it to JSON format const data = await response.json(); console.log(data); let name = data.map((a) => a.name); console.log(name); for (let i = 0; i < name.length; i++) { console.log(name[i]); let item = document.createElement('a'); item.appendChild(document.createTextNode(name[i])); specialisty.appendChild(item); } } getUser();
 <div id="specialisty-menu"></div>

about 4 years ago · Juan Pablo Isaza
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!