P粉4733635272023-08-23 12:27:07
If I want to see its status at the time of recording, I usually convert it to a JSON string.
console.log(JSON.stringify(a));
P粉4641130782023-08-23 11:29:35
I think you are looking for console.dir()
.
console.log()
cannot achieve the function you want, because it prints a reference to the object, and it has changed when you open it. console.dir
The attribute directory of the object will be printed when called.
The JSON idea below is a good one; you could even go ahead and parse the JSON string and get a browsable object, like .dir() would give you:
console.log(JSON.parse(JSON.stringify(obj)));