Can't get cubes to move left: Cube-Matcher

Hey there, I can’t seem to get the right code to move the empty columns to the left in Cube-Matcher. I was wondering if anyone could help.
Codecademy: Cube-Matcher

whenever I clear a column while playing the game it moves left but it also moves the columns that are already on the left side, over more.

const removeCols = () => {
// Declare a emptyCols here:
const emptyCols = board.map((col, i) => {

const isEmpty = col.every(cube => cube.removed)

if(isEmpty === true){
return board[i]
}else{return false}

}).filter(index => {
if(index === false){
return false
}else{return true}
})


// For each empty column, shift all remaining columns to the left
emptyCols.forEach(emptyCol => {
const columnsToMove = board.slice(emptyCol + 1);
// Update the properties of cubes of moved column
columnsToMove.forEach(col => {
col.forEach(cube => {
cube.x -= cubeSize;
cube.col--;
});
});
});
// Remove all empty columns from the board array
board.splice(emptyCols[0], emptyCols.length);
}



If anyone could give me advice or tips to fix this, please do.

It looks like you made a mistake on Step 17. In your .map(), you were supposed to return the index of the column i or false, but you’re returning board[i] or false

Thank you so much.
Worked on the first try.