日期:2014-05-16 浏览次数:20311 次
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"; });