Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(n) {
- let html = '<table border="1">\n' + '<tr><th>x</th>';
- for (let firstRow = 1; firstRow <=n; firstRow++) {
- html += `<th>${firstRow}</th>`
- }
- html += '</tr>\n';
- for (let row = 1; row <=n; row++)
- {
- html += '<tr>'
- html += `<th>${row}</th>`
- for (let col = row; col <= (n*row); col+=row) {
- html += `<td>${col}</td>`;
- }
- html += '</tr>\n'
- }
- html += '</table>'
- return html;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement