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
Because
checkerboard
is a two-dimensional array, so eachvalue
is an ordinary one-dimensional array. Through calculation,S1Item
is the element corresponding to the subscript of this one-dimensional array.