Reputation: 1
I'm doing an exercise for my coding class that requires to modify a tree in JavaScript, I think the code is right but testing with console.log
, I can't see the leaves:
{
val: 0,
son: [
{ val: 0, son: [Array] },
{ val: 3 },
{ val: 0, son: [Array] },
]
}
I need to know what's inside [Array].
Upvotes: 0
Views: 234
Reputation: 971
I think what you are looking for is JSON.stringify()
.
console.log(JSON.stingify({array: ['a','b','c']}))
This turns an object into an untruncated, readable string which will then be printed onto the console.
You can read more about it and the optional parameters here.
Upvotes: 3