for loop multiplication table javascript code example
Example: javascript multiplication table
let table = document.createElement("table");
for (i = 0; i < 10; i++) {
let tr = document.createElement("tr");
for (j = 0; j < 10; j++) {
let td = document.createElement('td');
td.innerHTML = (j + 1) * (i + 1);
// td.innerHTML += (i * j) + ' '; same output if i/j = 1 & i/j < 11
tr.appendChild(td);
}
table.appendChild(tr);
}
target.appendChild(table);