Public
Edited
Nov 30, 2023
1 fork
Insert cell
Insert cell
function* generateGrid() {
for (let y = 0; y < gridSize; y++) {
for (let x = 0; x < gridSize; x++) {
yield { x, y };
}
}
}
Insert cell
grid$ = generateGrid();
Insert cell
grid$.((data) => {
console.log(data);
});
Insert cell
// Set the size of the grid
gridSize = 8;



Insert cell
// Loop through rows (y-axis)
for (let y = 0; y < gridSize; y++) {
let row = '';

// Loop through columns (x-axis)
for (let x = 0; x < gridSize; x++) {
// Create cells or elements here
row += `[${x},${y}] `;
}

console.log(row); // Output the row in the console
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more