Why does the output of my objects break (in different lines) if there are more than 60 characters?

Asked

Viewed 43 times

0

My question is very simple: why if my object has more than 60 characters, in total, it prints in different lines each key and value, while if it has less than 60 all is printed in one line? It’s some kind of convention?

I did some research to find out if it was a convention and the most I could answer was not about specific programming, but about readability in general, but most spoke of 80 characters.

I searched the documentations but couldn’t find anything on either. I don’t have enough knowledge to do the test in Python, since I don’t know how to handle objects in the same way as JS.

For example:

let biblioteca = [
    { titulo: 'Os Miseráveis', autor: 'Victor Hugo', bibliotecaID: 4264 },
];

Returns, when calling console.log(biblioteca):

[
  { titulo: 'Os Miseráveis', autor: 'Victor Hugo', bibliotecaID: 4264 }
]

However, if I change the title of Os Miseráveis for Les Miserábles, thus passing 60 characters in the object line, the output is as follows:

[
  {
    titulo: 'Les Misérables',
    autor: 'Victor Hugo',
    bibliotecaID: 4264
  }
]

I tested Vscode with Code Runner and also tried Terminal to see if it was not a feature of Vscode, but in both the result was the same. I see no problem in this, although the second is much more readable, but I was curious: there is some explanation/reading about it?

Thank you!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.