Reputation: 253
I'm debugging Javascript app using Chrome dev tools and wondering if there any way to catch the exact line where a variable has changed its value? Object.observe seems not able to show the line number.
Upvotes: 1
Views: 220
Reputation: 14906
var b;
Object.defineProperty(window,'a',{
set : function(value){
b = value;
alert(new Error().stack.split('\n')[2]);
},
get : function(){
return b;
},
});
a = 1;
Upvotes: 1