'Multiplication table 1 x 1 = 1 | 1 x 2 = 2 | 1 x 3 = 3 using 2d array Javascript

I'm a beginner in Javascript and need to create multiplication table using 2d array. The result should be The result should be as below: 1 x 1 = 1 | 1 x 2 = 2 | 1 x 3 = 3. I have below variables which I can't modify. Can someone help?

const n = 3; const calc = [];

for (let i = 1; i < n; i++) {
    for (let j = 1; j < n; j++) {
    }
}console.log(calc);


Solution 1:[1]

Is this what you're looking for?

function calc(n){
for (let i = 1; i <= n; i++) {
    for (let j = 1; j <= n; j++) {
       console.log(`${i} * ${j} = ${i*j}`)
    }
}
}
calc(3)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ABGR