DEV Community

Raja Msuawir
Raja Msuawir

Posted on

How to get Single Console

My Sir Asked Me To creaeatee single console of this :

let tableOf2=[]
for(let i=1; i<=10; i++){
tableOf2.push({value : 2 x ${i} = ${2*i}})
}
// console.log(tableOf2)
let tableOf5=[]
for(let i=1; i<=10; i++){
tableOf5.push( {value :5 x ${i} = ${5*i}})
}
// console.log(tableOf5)
let combined=[
{
nameOfTable: Table Of 2,
table: tableOf2,
},
{
nameOfTable: Table Of 5,
table: tableOf5,
}
]
// console.log(combined[0])

and the console will be like this

console.log(1) >>>> Table of 5 <<<<

console.log(2) 2 * 1 = 2
console.log(3) 2 * 2 = 4
console.log(3++) ....... continue

Table of 5 <<<<



5 * 1 = 5
5 * 2 = 10
....... continue

Can Anyone Plz Help Me?

Top comments (0)