js赋值,字典,数据类型和参数传递的简单熟悉


之所以这样分,原因是布尔类型和整数浮点数在内存里是直接赋值的,而数组实际上数组名指的是这个数组的地址
字符串同样是地址,字典也是。
//熟悉赋值 var x=0; console.log(x); var y="hello js"; console.log(y); //熟悉字典 var biao={ st:"wode", hello:function(){ console.log("hello"); } } console.log(biao.st); console.log(biao.hello); biao.hello(); var c=[1,2,3,4,5]; console.log(c[0]); c[5]="hello"; console.log(c); var zidian={ name:"陈国松", age:20, nextage:function(age){ console.log(age+1); }, } zidian.nextage(zidian.age); //函数参数传递练习 var a=10,b=30; var x=function(a,b){ return a+b; } var y=x(a,b); console.log(y);

原文地址:https://www.cnblogs.com/chenguosong/p/10729496.html