js变量类型
js中有null和undefined,null是指對(duì)象不存在,undefined是指原生數(shù)據(jù)不存在
?
var h = {name:'lisi',age:28};
console.log(h.name)//對(duì)象用的是點(diǎn)語(yǔ)法,php中是name->'lisi'
下面是數(shù)組,數(shù)組用的是【】語(yǔ)法
1 var arr = ['a',3,'hello',true]; 2 console.log(arr); 3 //顯示結(jié)果為 4 ["a", 3, "hello", true]它的索引不會(huì)空缺,如果你刪掉某個(gè)索引,它會(huì)立即重排,從0開始往下排
var arr = ['a',3,'hello',true]; console.log(arr[3]); //結(jié)果為true,下標(biāo)從0開始但是,對(duì)象也可以用中括號(hào)
console.log(h['name']);//結(jié)果為lisi所以,js中對(duì)象很像php中的關(guān)聯(lián)數(shù)組,perl語(yǔ)言中的哈希,也叫關(guān)聯(lián)數(shù)組
轉(zhuǎn)載于:https://www.cnblogs.com/a2762/p/4123073.html
總結(jié)
- 上一篇: Mysql按日分表如何实现批量修改表结构
- 下一篇: 20141126-解决联网问题-笔记