<!DOCTYPE html> <head> <meta charset="UTF-8"> <title>JavaScript大造乘法表</title> </head> <body> <script> for (var A = 1; A <= 9; A++) { document.write("<br>"); for (var B = 1; B <= A; B++) { document.write(A+"x"+B+"="+A*B+" "); } } </script> </body> </html>
B<=A时,B随着A递减,形成梯形