首页 > 编程语言 > 详细

javascript 基础系列(一)

时间:2016-09-23 10:55:32      阅读:216      评论:0      收藏:0      [点我收藏+]

闭包:

function 内部访问外部的variables

function f(){
 alert(ysr);
}

  技术分享

报错了。

Certain language constructs block the error, for example typeof x works if there is no x (and returnsundefined), but that’s an exception.
特定的语言结构是可以阻塞(拦截)这种错误的,(不让这种错误弹出来!!)。 比如 : typeof ysr, 先用这种语言结构检测一下,就不会报错了!!

 If a variable is set, but not found anywhere, then it is created in the outmost LexicalEnvironment, which iswindow.

function f() {
  x = 5 // writing x puts it into window
}

  

javascript 基础系列(一)

原文:http://www.cnblogs.com/oxspirt/p/5899080.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!