Skip to content

Commit ba8bec0

Browse files
committed
Ensure property is own when iterating over nodes object
1 parent b193942 commit ba8bec0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/neural-network.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -982,9 +982,11 @@ export default class NeuralNetwork {
982982
const nodes = Object.keys(layer);
983983
this.sizes[i] = nodes.length;
984984
for (let j in nodes) {
985-
const node = nodes[j];
986-
this.biases[i][j] = layer[node].bias;
987-
this.weights[i][j] = toArray(layer[node].weights);
985+
if (nodes.hasOwnProperty(j)) {
986+
const node = nodes[j];
987+
this.biases[i][j] = layer[node].bias;
988+
this.weights[i][j] = toArray(layer[node].weights);
989+
}
988990
}
989991
}
990992
}

0 commit comments

Comments
 (0)