function displayInfo(args){
var output = "";
if(typeof args.name == "string"){
output += "Name:" + args.name + "\n";
}
if(typeof args.age == "number"){
output += "Age:" + args.age + "\n";
}
alert(output);
}
displayInfo({
name:"Nicholas",
age:29
})
displayInfo({
name:"Greg"
})
1.为什么这里把 output += "Name:" + args.name + "n"; output += "Age:" + args.age + "n";的 += 变成 + 结果会不一样
2.var output = ""; 在这里有什么含义
神不在的星期二
相关分类