/**
* write by waitingbar
* time : 2013.08.20
* 用途:这种传递参数的模式最适合向函数传入大量可先参数的情形;
*
**/
function outputInfo(args){
var output = "";
//判断,如果args.name 为字符串
if (typeof args.name == "string"){
output += "Name: " + args.name + " ";
}
//判断,如果args.name 为数值
if(typeof args.age == "number"){
output += "Age: " + args.age + " ";
}
//输出值
alert(output);
}
//这里的年龄值不能用引号引起来,否则就是字符串类型了
outputInfo({name:"waitingbar",age:27});
tips:源码下载:http://files.cnblogs.com/waitingbar/2013.08.20.rar