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

177
Views
getting undefined after .push() objects from Constructor json

Hi im trying to acces my data but geting undefined console.log(creature.species). the output for console.log(creature) is: console.log(craeture)

and here is my code:

    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!