JS realizes output ninety-nine multiplication table

JS realizes output ninety-nine multiplication table

1 1=1
1
2=2 2 2=4
1
3=3 2 3=6 3 3=9
1 4=4 2 4=8 3 4=12 4 4=16
1 5=5 2 5=10 3 5 =15 4 5=20 5*5=25
…The
code is as follows:
for (let i = 1; i <= 9; i++) { let str = ``; //Clear the result of the previous loop for (let j = 1 ; j <= i; j++) { str += ;//string splicing } console.log(str); }


${j}*${i}=${j * i}


Guess you like

Origin blog.csdn.net/dabaiZhang/article/details/108569041