Reputation: 197
When I'm debugging my javascript I can't inspect my objects in the console. They always throw the error "Uncaught ReferenceError: X is not defined(...)
You can see in the screenshot below that I've paused the debugger at activate()
The console.log() calls both properly display what's in the respective object but when I try to see the objects by typing them in the console I get the errors.
I'm using Chrome 45.0.2454.85 m
Upvotes: 8
Views: 6625
Reputation:
If your code is minified, the variable and function names probably have changed.
If not:
test
is only defined in the scope of userController, that's why you can not access it like this from the console.
vm
is defined in the scope of userController aswell.
example:
var test = "1";
function foo(){
var bar = "2";
console.log(bar); #2
}
foo(); #will log "2"
console.log(test); #1
console.log(bar); #undefined
Upvotes: 7