admin管理员组文章数量:1315994
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
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
Share Improve this question asked Sep 8, 2015 at 13:20 CooperCooper 1971 silver badge12 bronze badges 5- 1 are you minifying the JS code and using a source map? – sahbeewah Commented Sep 8, 2015 at 13:23
- are you actually on the activate() line, or have you stepped into the activate function? – sahbeewah Commented Sep 8, 2015 at 13:27
- I'm minifying the JS code and using a source map. Enable JavaScript source maps is checked in the settngs. – Cooper Commented Sep 8, 2015 at 13:28
- Minifiers usually changes variable & function names. – user3946265 Commented Sep 8, 2015 at 13:29
- I have not stepped into the activate function. – Cooper Commented Sep 8, 2015 at 13:29
1 Answer
Reset to default 7If 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
本文标签: javascriptUncaught ReferenceError in Chrome dev toolsStack Overflow
版权声明:本文标题:javascript - Uncaught ReferenceError in Chrome dev tools - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741971982a2407895.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论