HSQCoollaughing

Results 7 comments of HSQCoollaughing

var arr = [1,2,3,4,5]; for(var i = 0 ; len = arr.length ; i < len; i++){ console.log(i); //1 2 3 4 5 } 语法好像错了

> Hey, super sorry I didn’t get around to this—slipped off my plate. I’ll get back to you in

闭包,一个特殊的对象

闭包是一个特殊的对象 它由两部分组成,执行上下文A以及在A中创建的函数B。 当B执行时,如果访问了A中的变量对象,那么闭包就会产生。

由此可见,console.log打印出来的内容并不是一定百分百可信的内容。一般对于基本类型number、string、boolean、null、undefined的输出是可信的。但对于Object等引用类型来说,则就会出现上述异常打印输出。 所以对于一般基本类型的调试,调试时使用console.log来输出内容时,不会存在坑。但调试对象时,最好还是使用打断点(debugger)这样的方式来调试更好。