function jsonObj(){
var person= {name: 'zhangsan',pass: '123' ,'' : 'XMQ',back:function (){
for(var i=0;i<;i++){
//You can traverse through the for loop without knowing the number of parameters
// arguments is provided by js by default
alert("arr["+i+"]="+arguments[i]);
}
}
};
//Travel the properties
for(var item in person){
if(typeof person[item] === 'string'){
alert(the value of "+item+" in "person="+person[item]);
}else if(typeof person[item] === 'function'){
person[item](1,1);
//The parameters of js function can be changed dynamically
}
}
//Add attributes
= 'kaobian';
// This is the normal attribute name
//When the attribute name is abnormal, like the following, it must be in this form.
person[''] = 'hello kaobian';
//The above can also be used in the following form
for(var item in person){
if(typeof person[item] === 'string'){
alert(the value of "+item+" in "person="+person[item]);
}else if(typeof person[item] === 'function'){
person[item](1,1);
}
}
}