Reputation: 4254
Got a wierd problem. I console.log an object. As you can see in the picture, on object is undefined but when i flip it out you can see it have an array.
If i console.log obj.matchcvs
i get undefined
How can this be? Bug in chrome dev tools?
Upvotes: 2
Views: 1424
Reputation: 12238
When you click on object in dev tools and "opens" it chrome displays it's current state. But when the object is shown in "short" version, only snapshot version of object is displayed that was created when the console.log function was called.
(function(){
var a = { x: 0 };
// Log variable "a", current snapshot is saved
console.log(a);
// Now modify the variable
a.x = 1;
})()
Try to run this code in your dev tools, you will see that "short" version displays object with property x
set to 0, when you opens it, property x
is set to 1. That is because when the snapshot was created, property x
was set to 0.
Upvotes: 3