JavaScript Program to print table of any number

In this program, you will learn how to print a table of any number in JavaScript.


for(initialization; condition; increment/decremnet){
       //statement
}

JavaScript Program to print table of any number

Example: How to print a table of any number in JavaScript

let x = prompt("Enter a number")

for(let i=1; i<=10; i++){
  console.log(x*i)
}

Output:

Enter a number> 3
3
6
9
12
15
18
21
24
27
30