JSFiddle - React, Tailwind, and code Playground
HTML
<h1>
Где DIV'Ы?
</h1>
CSS
.cell {
display: inline-block;
border: 1px solid black;
}
JavaScript
function Grid(height, width) {
this.space = new Array(height * width);
this.height = height;
this.width = width;
}
Grid.prototype.render = function () {
for (let y = 0; y < this.height; y++) {
for (let x = 0; x < this.width; x++) {
let cell = document.createElement("div");
//cell.innerHTML = this.space[x + (y * width)];
cell.innerHTML = "x";
cell.className = "cell";
document.body.appendChild(cell);
}
let translate = document.createElement("br");
document.body.appendChild(translate);
}
}
let map = new Grid(5, 5);
document.body.onload = map.render;