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

190
Views
quedar indefinido después de los objetos .push() de Constructor json

Hola, estoy tratando de acceder a mis datos, pero obtengo un archivo console.log (criatura.especies) indefinido. la salida para console.log(criatura) es: console.log(criatura)

y aquí está mi código:

 function Creature(species, weight, height, diet, where, when, fact, name) { this.species = species; this.weight = weight; this.height = height; this.diet = diet; this.where = where; this.when = when; this.fact = fact; this.name = name; } //Get dinoData from dino.json and Create Dinosaurs let creature = []; console.log(creature) function createDino() { return fetch("dino.json") .then(function(response) { return response.json(); }) .then(function({ Dinos }) { Dinos.map(function(dinosaurs) { let dino = new Creature(...Object.values(dinosaurs)); delete name; creature.push(dino); }) }) }; createDino(); console.log(creature.species)
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!