Is console.log Synchronize or asynchronous?

clipboard.png

clipboard.png

the output results of the two types are not the same
there is data in the obj output from the first picture, but it is undefined when it is obtained.


get the value once when you output from the console
when you click the drop-down to expand more, it will get the value again


clipboard.png

"i"

clipboard.png


console
console.log()


clipboard.png

JavaScript



clipboard.png


Synchronize next question


console is asynchronous. For more information, please take a look at this issue, which was accidentally discovered by a memory leak

.

https://github.com/nodejs/node/issues/2970

highlight console output is buffered and async.

but when it comes back to the topic, this place is really because of the citation problem


the first picture when you print obj.aaa, the object obj does not have the attribute of aaa. Of course, it is undefined. After you assign a value to obj.aaa='aaa', you can print out aaa

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e89d9c-f8c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e89d9c-f8c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?