方法一:
for(var i=1;i<=9;i++){
document.write("<br>");
for(var j=1;j<=i;j++){
sum = i*j;
document.write(i,"*",j,"=",sum," ");
}
}
方法二:
for(var i =1;i<10;i++){
let a = '';
for(var j=1;j<i+1;j++){
a+=`${j}*${i}=${i*j}`
}
console.log(a)
}
网友评论