从控制台访问匿名函数对象

从控制台访问匿名函数对象

本文介绍了从控制台访问匿名函数对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我知道如果我声明一个对象:I know that if I declare an object like:var myObj = { prop1 : 1, prop2 : 2} 我可以访问和操作I can access and manipulate it from the console by typing myObj.如果我在一个匿名的自执行函数中包装它,那么可以从控制台输入 myObjIf I wrap it in an anonymous self-executing function, can I still access it from the console?(function(){ var myObj = { prop1 : 1, prop2 : 2 }})();推荐答案您可能可以。例如,在Chrome中,您可以在正确的位置插入断点,然后您可以访问(并操作)。For example in Chrome, you can insert a breakpoint at the correct position, then you can access (and manipulate) it.(这个截图的有趣事实是你的匿名函数实际上是在另一个匿名函数内)(A fun fact of this screenshot is that your anonymous function is actually inside another anonymous function)对于Firefox我相信FireBug可以做这项工作。 IE8 +还具有功能。For Firefox I believe FireBug can do the job. IE8+ also has the functionality. 这篇关于从控制台访问匿名函数对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-04 06:27
查看更多