您的位置:首页 > Web前端

前端调试技巧

2015-06-15 15:09 344 查看
1.console.log

console.log(test());     // 1
delete test;
console.log(typeof test);     // undefined


2.eval

var GLOBAL_OBJECT = this;

/* `foo` is created as a property of calling context Variable object,
which in this case is a Global object */

eval('var foo = 1;');
GLOBAL_OBJECT.foo; // 1


3.delete 操作符

var o = { x: 1 };
delete o.x; // true
o.x; // undefined

http://www.cnblogs.com/jscode/archive/2012/09/02/2667464.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: