js中的json. 一種
輕量級
數據格式.
json中的值是map形式的就是
key->value. 具體看下邊的示例;
var person = { // 用
大括號括聲明一個json.
"name":"lz" //key是name, value是lz;
};
//這個時候你可以這樣使用它
alert(person.name);
//-----------如果你試了一下代碼,到這里你應該明白它是什么格式了..
//------a:function(){} 中 a是key,function() 是 value
var person2 = {
"name":"lz", //有多個 key,value 用,號分開.
"say" : function(){
alert('hello word!');
}
}
person2.say();
/ *
其中 say:function(){alert('hello word!')}; 類似於
var say = function(){
alert('hello word!');
};
*/