js基础

来源:互联网 发布:gta5捏脸数据希斯莱杰 编辑:程序博客网 时间:2024/06/03 19:06


数据类型

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





0 0
原创粉丝点击