使用开发人员工具逐步实现javascript中的匿名函数
例如,我想检查名为“test”的变量使用开发人员工具逐步实现javascript中的匿名函数,javascript,Javascript,例如,我想检查名为“test”的变量 (function() { var test = function(){alert("hello");}; test(); })(); 添加断点是实现这一点的唯一方法吗,还是[chrome | javascript | developer tools]特有的忍者富?您可以尝试以下方法:- console.error(e); (function() { var test = function(){alert("hello"
(function() {
var test = function(){alert("hello");};
test();
})();
添加断点是实现这一点的唯一方法吗,还是[chrome | javascript | developer tools]特有的忍者富?您可以尝试以下方法:-
console.error(e);
(function() {
var test = function(){alert("hello");};
test();
console.error(e);
})();
或者
console.log(test)
:)你期待什么忍者富?我猜你的问题不是关于匿名函数test
,而是关于IEFE中的局部变量test
,不是吗?alert()和console.log()都会污染代码,我需要很多它们来做我在这里做的事情(通过检查其他人的代码来学习)。我希望有一些内置的技巧来查看范围外的变量。
(function() {
var test = function(){alert("hello");};
debugger;
test();
})();