+ 1
How to print array elements in one line ,in Javascript
function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here var n=prices.length; for(var i=0;i<n;i++) { prices[i]=prices[i]+increase; } console.log("["); for(var i=0;i<n;i++) { console.log(prices[i]); } console.log("]"); }
9 ответов
+ 4
You don't need to loop over the array to print it
You can just try
console.log(prices);
it will print it in one line
+ 2
Thnx
But it will not give space between the elements
+ 2
Thnx bro
+ 1
How to print array elements like [98.99,15.2,20,1026]
+ 1
https://code.sololearn.com/c0j561PipZ9E/?ref=app
I think it gives enough space between array elements 😅
Can you tell how exactly you want the spaces
+ 1
[Space 4,space 5,space 6 space]
I need this spaces which will be filled with space
0
Is this what you are trying to do?? PRAKASH CHANDRA MOHAPATRA
https://code.sololearn.com/c1R7oJqBLp8C/?ref=app
0
Oho