0

Using tensorflow.js on Google Chrome I noticed an unexpected behaviour extracting values from an array.

The code is very simple:

console.log(boxes); // Array of 1200 positions.

let order = [];

for (let i = 0; i < 10; i++) {
    order.push(boxes[i*4 + 1]);
}

console.log(order); // Array of 10 positions with values from 'boxes'.

The source array boxes is the following:

enter image description here

The destination array order is the following:

enter image description here

When I copy values from the original array boxes, all the values in the order array are 2. I tried to parse the values to a string, but the result is the same:

enter image description here

Tested on Firefox and same result.

Why does this happen?

cespon
  • 5,630
  • 7
  • 33
  • 47

0 Answers0