for(var second=1; second<=9; second++)
{
//'string'.repeat(5) 对string重复5次
document.write(` `.repeat((9-second)*6));
for(var first=1; first<=second; first++)
{
document.write(first,'*',second,'=',first*second,' '.repeat(2));
}
document.write(`<br/>`);
}
输出结果: