You are given a 3x3 grid with labeled cells. Your task is to simulate a journey through the grid using specific movements. Use the array to represent the grid and track your path with an array that records each move you make.
Goal: Start at cell A (position [0][0]) and move through the grid using a combination of right, down, and left movements. Make sure to track each cell you visit.
Start at A
Move right to B
Move right to C
Move down to F
Move left to E
- Create a 3x3 grid using a 2D array.
- Use variables x and y to keep track of your current position on the grid.
- Use .push() to record each position visited in the moves array.
- Print the journey as a string separated by "→" and output the total number of moves (excluding the starting position).
// Move Right to C
// Move Down to F
// Move left to Efunction moveRight() {}
function moveLeft() {}
function moveUp() {}
function moveDown() {}