0

In JavaScript I need an object that has an array of other object

Hi, trying to make a Neural Network on Js. I need an object that has an array of other object

I create the Neuron object and then I create the Layer object, Layer should have an Neuron Array... How do I write this?

//----------------
let Neuron = {
    value: 0    
    Links: []
    Activate: function(){
        //Activacion Sigmoid
        value = (1 / (1 + Math.exp(-value)));
    }
}

let Layer = {
    ??? Neurons: [] new Neuron ???
}

1 Answers1

0
let Layer = {
    Neurons: [...Array(5).keys()].map(() => new {...Neuron})
}
Vulwsztyn
  • 2,140
  • 1
  • 12
  • 20