'Javascript multiplier in table - Basic

I'm new at JavaScript. I want to make a multiplier in Javascript using prompt() to get the number n, this is our multiplier, I want to multiply all numbers from 1 to n with the n number. Example:

if n=4

and then for bonus eliminate all the same products, so we consider that 23 = 32, and it should look something like this:

so, my code so far:

// JavaScript Document

function TableOn() { document.write('<table border="1">'); }
function TableOff() { document.write('</table>') }
function TrOn() { document.write('<tr>'); }
function TrOff() { document.write('</tr>'); }
function TdOn() { document.write('<td>'); }
function TdOff() { document.write('</td>'); }
function Izvrsi() {
    var n;
    n = prompt('Insert the multiplayer (n)');
    script0 = TableOn();
    for (var i = 0; i <= n; i++) {
        script1 = TrOn();
        /*for(var j=0;j<=n;j++)
            {
                script2 = TdOn();
                document.write(j * n + ' ');
                script6 = TdOff();
            }*/
        script2 = TdOn();
        document.write(i + ' ');
        script3 = TdOff();
        script4 = TrOff();
    }
    for (var j = 0; j <= n; j++) {
        script11 = TrOn();
        script2 = TdOn();
        document.write(j * n + ' ');
        script6 = TdOff();
        script12 = TrOff();
    }
    script5 = TableOff();
}

I'm probably not doing something right, can you help me out?



Sources

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

Source: Stack Overflow

Solution Source