cf.completefrontend

Predict the outputMedium

What does this log for a grid built with fill([]) and one built with Array.from?

What does this log?
const grid = new Array(3).fill([]);
grid[0].push("x");
console.log(grid);
console.log(grid[0] === grid[2]);
 
const rows = Array.from({ length: 3 }, () => []);
rows[0].push("x");
console.log(rows);

The answer

Work out every line it logs, in order. Then check.

Checking your sign-in…