html>
<head>
<title>Multiplication Table</title>
<script type="text/javascript">
var rows = prompt("How many rows for your multiplication table?");
var cols = prompt("How many columns for your multiplication table?");
if(rows == "" || rows == null)
rows = 10;
if(cols== "" || cols== null)
cols = 10;
createTable(rows, cols);
function createTable(rows, cols)
{
var j=1;
var output = "<table border='1' width='500' cellspacing='0'cellpadding='5'>";
for(i=1;i<=rows;i++)
{
output = output + "<tr>";
while(j<=cols)
{
output = output + "<td>" + i*j + "</td>";
j = j+1;
//The shift() method removes the first array element and "shifts" all other elements to a lower index.
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.shift();
// The shift() method returns the value that was "shifted out": >> Banana
//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
<!-- on charge p5.js
*************************************************
attention src="//…" ne marchera que sur un serveur et bascule en https ou http !
sans serveur src="http://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.10/p5.js"
************************************************* -->
<script src="//cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.10/p5.js"></script>
<script>
//The length property provides an easy way to append a new element to an array:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits[fruits.length] = "Kiwi"
// >> ["Banana", "Orange", "Apple", "Mango" , "Kiwi"]
//if you find this answer is useful ,
//upvote ⇑⇑ , so the others can benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
//The unshift() method adds a new element to an array (at the beginning), and "unshifts" older elements:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.unshift("Lemon");
//The unshift() method returns the new array length : >> 5
/*if you find this answer is useful ,
upvote ⇑⇑ , so the others can benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)*/
<!-- on charge p5.js
*************************************************
attention src="//…" ne marchera que sur un serveur et bascule en https ou http !
sans serveur src="http://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.10/p5.js"
************************************************* -->
<script src="//cdnjs.coudflare.com/ajax/libs/p5.js/0.5.10/p5.js"></script>
<script>
var d1 = random(1, 7);
var d2 = random(1, 7);
var d3 = random(1, 7);
var d4 = random(1, 7);
</script>
<!-- on charge p5.js
*************************************************
attention src="//…" ne marchera que sur un serveur et bascule en https ou http !
sans serveur src="http://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.10/p5.js"
************************************************* -->
<script src="//cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.10/p5.js"></script>
<script>
var d1 = random(1, 7);
var d2 = random(1, 7);
var d3 = random(1, 7);
var d4 = random(1, 7);
</script>
js basic code example