Step idea:
1. Use for loop to print 99 multiplication table
2. 9 rows and 9 columns, double for, empty string, escape character spacing tab, newline
3. Variable storage — number, row, column
Show one
function getForm() {
var num = '';
for (var rows = 1; rows <= 9; rows++) {
for (var cols = 1; cols <= rows; cols++) {
num += cols + '×' + rows + '=' + rows * cols + '\t';
}
num += '\n';
}
return num;
}
console.log(getForm());
Show two
function getTable() {
var str = '';
for (var row = 9; row > 0; row--) {
for (var col = 1; col <= row; col++) {
str += col + '×' + row + '=' + row * col + '\t';
}
str += '\n';
}
return str;
}
console.log(getTable());