Why my cosole is not showing an array in one line?

Question:

Current behavior:

Desired behavior

Repl link:

code snippet

Hey @DivyanshVerma19, welcome to the forums!

Could you provide a Repl link and more info about your problem?

1 Like

Is this the Repl your talking about?

I think it is because your console screen is not big enough for the array to be shown on only 1 line, so the system automatically pushes the rest to a new line.

However, since we do not have any information about this except your problem, I don’t think we can actually find the real reason of this problem, especially without your code and the language you wrote the code in.

3 Likes

You can use

console.log(JSON.stringify(num))

to force it onto 1 line. Note that console.table is a cool way of representing objects, especially nested ones

3 Likes