Just a quick suggestion, how do I define this properly?

Just a quick question. In the tutorial, when he creates the first level on “Loading/Building Levels”, he was making the function that creates the brick structure. Since this was made in 2018, Code Sandbox probably got updated and now the same program does not work because “brick is not defined”. Here is a image:

This is specifically where the problem is:

level.forEach((row, rowIndex) => {
    row.forEach(brick, brickIndex => {
      if (brick === 1) {
        let position = {
          x: 80 * brickIndex,
          y: 20 + 24 * rowIndex

How do I define “brick” ? I am a beginner BTW.



you need to surround the callback parameters in round parenthesis
as (brick, brickIndex) => ...
otherwise, it is trying to call the brick function, which doesn’t exist

1 Like