How to output a full object in console.log in Node.js instead of '[Object]'?
Hi! I'm new to Node.js and encountered a problem while debugging code. When I try to output an object via console.log(), the console only shows `[Object]` or `[Array]` instead of the object's contents. This is very inconvenient when I need to see what's inside.
Here's an example of my code:
```javascript
const user = {
name: 'Иван',
age: 30,
address: {
city: 'Москва',
street: 'Ленина',
house: 10
},
hobbies: ['книги', 'спорт', 'программирование']
};
console.log(user);
// Outputs: { name: 'Иван', age: 30, address: [Object], hobbies: [Array] }
```
I expected to see the full contents of the object, but instead I only see the top level, while nested objects and arrays are displayed as `[Object]` and `[Array]`. How can I make console.log show all the contents o
No answers yet.
Log in to leave an answer