While working on defining an array within the Fire array in my code, I encountered a problem.
When I tried to use console.log() to display the length of the array inside the Fire[] array for debugging, I received an error indicating that the array was undefined. Here's the snippet of my code:
var Fire = [];
var fire = function FireGen()
{
this.particle = [];
var part = function Particle()
{
};
this.particle.push(part);
};
Fire.push(fire);
console.log(Fire.particle.length); //Outputs undefined
As someone who is relatively new to using objects and arrays in JavaScript, I would greatly appreciate it if someone could shed light on why my array is ending up undefined.