代码如下
- JScript code
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"; });
是不是缺window.onload = displayInfo; ?
加上window.onload = displayInfo; 也不行!
------解决方案--------------------
displayInfo({
name : "Greg" /* ; */
});
多一个分号