Note that there is no operator in the middle. I saw a piece of code like this:
this.checkerboard.forEach((value, index) => {
const S1Item = value[y - (x - index)];
})
this.checkerboard
is a two-dimensional array. How do you get the value saved in const S1Item
?
================================================ ============================
x, y are positive integers, equal to (array.length
) positive integers, and each of the x, y values are the same
淡淡烟草味2017-06-26 10:53:39
Because checkerboard
is a two-dimensional array, so each value
is an ordinary one-dimensional array. Through calculation, S1Item
is the element corresponding to the subscript of this one-dimensional array.