码迷,mamicode.com
首页 > 编程语言 > 详细

javascript 基础系列(一)

时间:2016-09-23 10:56:36      阅读:105      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!