Creating multiplication table using js loop
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <script> //simple multiplication table for(let i = 1; i < 13 ; i++){ for(let j = 1; j < 13 ; j++){ console.log(`${j} x ${i} = ${j*i}`) } } /* =The outer loop counts up from i=1 to i=12. For every iteration of the outer loop, the inner loop counts up from j=1 to j=12. This means that it starts in the first iteration with i = 1 and j = 1, producing the following output that is logged to the console: << 1 multiplied by 1 is 1 In the next iteration, we are still inside the inner loop, so i remains as 1, but j is incremented to 2, giving: << 1 multiplied by 2 is 2 j continues to increase until it reaches 12. After this, we leave the inner loop and return to the outer loop, where i increases to 2. We then re-enter the inner loop and j is reset back to 1 and begins counting up to 12 again. This continues until the last iteration produces the line: << 12 multiplied by 12 is 144 */ </script> </body> </html>