您的位置:首页 > Web前端 > JavaScript

js基础

2016-05-06 18:58 399 查看
数据类型

undefined,null,number,boolean,string,

null 和undefined值是相等的

typeof 运算符 :返回一个用来表示表达式的数据类型的字符串

typeof的运算数未定义或定义未赋值,返回的就是“undefined”

运算数为数字 typeof(x) = "number"

字符串 typeof(x) = "string"

布尔值 typeof(x) = "boolean" true false

对象,数组和null typeof(x) = "object"

函数 typeof(x) = "function"

调试

alert

document.write()

console.log()

作用域,闭包

作用域为可访问变量,对象,函数的集合。

闭包是可访问上一层函数作用域里变量的函数,即便上一层函数已经关闭。

见此文档 http://blog.csdn.net/zzulp/article/details/8144520
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: