// Blank array to hold the final multiplication table
var multiplicationTable = [];

// Prompt user for the number of table values
var numNums = prompt("How many values for the multiplication table?");

// Outer for loop for the x values
for (let i = 1; i <= numNums; i++) {

    // Inner for loop for the y values
    for (let j = 1; j <= numNums; j++) {

        // Push an array with the x, y, and multiplied values to the final table array
        multiplicationTable.push([i, j, i * j]);

    }

}

// Loop to print table values
for (let i = 0; i < multiplicationTable.length; i++) {

    // Variable to hold a fully-formated string to be printed to console
    let formattedString = "";
    
    // Inner loop that loops through sub-array values
    for (let j = 0; j < multiplicationTable[i].length; j++) {

        // Add the current sub-array value to the formatted string
        formattedString += multiplicationTable[i][j];

        // If the inner loop control is 0, add the '*' symbol between numbers
        if (j == 0) {

            formattedString += " * ";

            // If the inner loop control is 1, add the '=' symbol between numbers
        } else if (j == 1) {

            formattedString += " = ";

        }

    }

    // Print fully-formatted string to console
    console.log(formattedString);

}