multiplication in js code example

Example 1: how to do multiplication in javascript

//To multiply in Java script, you have to put an asterisk symbol '*' between them. If you have stored two numbers in variables, just put an asterisk symbol between the variable names.
//For example:
var a = 5
var b = 6
var c = a*b
var d = 5*6

Bot.send (c)/ print (c)// or whatever you use to get output
Bot.send (d)/ print (d)// or whatever you use to get output

//output will be: 30, 30

Example 2: javascript multiplication table

let table = document.createElement("table");
    for (i = 0; i < 10; i++) {
        let tr = document.createElement("tr");
        for (j = 0; j < 10; j++) {
            let td = document.createElement('td');
            td.innerHTML = (j + 1) * (i + 1);
            // td.innerHTML += (i * j) + ' '; same output if i/j = 1 & i/j < 11
            tr.appendChild(td);
        }
        table.appendChild(tr);
    }
    target.appendChild(table);

Tags:

Html Example