12345678910111213141516171819202122232425 |
- let multiplyTable = [];
- for (let i = 1; i <= 10; i++) {
- multiplyTable[i] = [];
- for (let j = 1; j <= 10; j++) {
- multiplyTable[i][j] = j * i;
- }
- }
- const htmlTable = (arr) => {
- let result = "<table>";
- for(let i = 1; i < arr.length; i++) {
- result += "<tr>";
- for(let j = 1; j < arr[i].length; j++){
- result += `<td>${arr[i][j]}</td>`;
- }
- result += "</tr>";
- }
- result += "</table>";
- return result;
- }
- document.querySelector('body').insertAdjacentHTML('beforeend', htmlTable(multiplyTable));
|