Your Console Screenshot Shows Values That Never Coexisted

javascript dev.to

Three lines, from MDN's own documentation for console: const obj = {}; console.log(obj); obj.prop = 123; That logs {}. Expand the object in the console afterwards and you see prop: 123. MDN states the mechanism plainly: "Information about an object is lazily retrieved. This means that the log message shows the content of an object at the time when it's first viewed, not when it was logged." Not when it was logged. That is the whole article, and it has a consequence most people have ne

Read Full Tutorial open_in_new
arrow_back Back to Tutorials