how to make a tile generation system in javascript

Solutions on MaxInterview for how to make a tile generation system in javascript by the best coders in the world

showing results for - "how to make a tile generation system in javascript"
Kamil
01 Feb 2019
1// get the table body element
2const table = document.getElementById("tbody");
3
4// generate the tiles
5for(var y = 0; y < 10; y++) {
6	// creating rows elements for the table
7	tableRow = document.createElement("tr");
8  	// putting the new rows into the table
9  	table.appendChild(tableRow);
10  	for(var x = 0; x < 10; x++) {
11    	// creating the tiles
12    	tile = document.createElement("td");
13      	// displaying the tiles
14      	tableRow.appendChild(tile);
15    }
16}