关于js中基本类型和引用类型传参
//对于基本类型js参数传的是值 var a = 5;function (a) { a = 10;}alert(a);//5 //对于引用类型,js 参数传地址 var arr = ['a'];function put(arr){ arr.push('b');}put(arr);alert(arr)//a,b?
js数据类型如下【转】:
var num = str_val - 0;测试null与undefined<html> <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title>null and undefined</title> </head> <body><p>比较null与undefined</p><script> var undef; document.write("布尔环境: ") document.write(undef==null); //true document.write("<br/>"); document.write("字苻串环境: ") document.write("".undef); //undefined document.write("<br/>"); document.write("数字环境: ") document.write(1+undef); //NaN document.write("<br/>"); document.write("undef===null: ") document.writeln(undef===null); //false document.write("<br/>"); document.write("typeof undef: ") document.writeln(typeof undef); //undefined</script> </body></html>?
?
2)复合类型
对象:已命名的数据的集合
对象直接量:由一个列表构成.列表的表式形式,{key:value,*};(key=标识符/字符串,value=常量/表达式)
对象转换:布尔环境式时,非空对象为true;字符串环境时,toString();数字环境时,valueOf();
数组
不直持多维数组,数组元素可以是数组;
数组元素不必据有相同的类型
?
3)特殊对象
函数
一般语法,function func_name(args) {func_body;}
lambda函数,function(args){func_body;}
构造函数,new Function("args","func_body");
?
*说明
计划以后在note目录下发布些整理的笔记,好记心不如烂笔头.主要为了方便自己查找,若读者看了觉得哪儿理解不对,请指教.
这篇是关于javascript的数据类型,主要内容来自"javascript权威指南".