Cube Matcher stuck on step 13

Hi, I am stuck on the Cube Matcher step 13. I believe the issue is in my iteration through neighborCubes but I cannot figure out what is wrong. The cubes show up correctly but when I test the game, nothing happens when I click a cube.

Any hints would be greatly appreciated, thanks!

// Listener for clicks on cubes

this.input.on('gameobjectdown', function(pointer, cube, event) {

  // Declare a constant, neighborCubes, below

  const neighborCubes = getNeighbors(cube);

  // Remove matching cubes from game if there's at least 2 of them

  if (neighborCubes.length > 0) {

    // Update score

    score += neighborCubes.length;

    scoreText.setText(`Score: ${score}`);

    // Update each cube in neighborCubes here

    neighborCubes.foreach(neighbor => {





  // Helper function moves cube sprites down

  function renderCubes(cube) {

    for (let row = 0; row < cube.row; row++) {

      // Move cube sprite down by 30px

      board[cube.col][row].y += cubeSize;

      // Update the row of cube

      board[cube.col][row].row += 1;


    // Update board array

    let removed = board[cube.col].splice(cube.row, 1);

    board[cube.col] = removed.concat(board[cube.col]);





Change foreach() to forEach()
JavaScript uses camelCase.

Thank you for your help! That seems to consistently be my problem, I will continue to work on that.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.