How to print output in a single line?
my code
let a = userInput[0].split(" ");
let m = 0;
for(let i=0;i<=a[0];i++)
{
m+=parseInt(a[0]);
console.log(m);
}
5
10
15
20
25
30
My o/p should be like this 5 10 15 20...(spaces between them)
How to print output in a single line?
my code
let a = userInput[0].split(" ");
let m = 0;
for(let i=0;i<=a[0];i++)
{
m+=parseInt(a[0]);
console.log(m);
}
5
10
15
20
25
30
My o/p should be like this 5 10 15 20...(spaces between them)