search

Home  >  Q&A  >  body text

What is the result of [array A][array B]?

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

阿神阿神2768 days ago787

reply all(1)I'll reply

  • 淡淡烟草味

    淡淡烟草味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.

    reply
    0
  • Cancelreply