以下两种传参的方式哪个更好?/** * [sayHello description] * @Author Wangduanduan * @DateTime 2016-12-08T14:15:01+0800 * @param {[String]} name [agent name] * @param {[String]} age [agent age] * @param {[String]} sex [agent sex] * @return {[]} [description] */function sayHello(name, age, sex){ console.log(name); console.log(age); console.log(sex);}/** * [sayHello2 description] * @Author Wangduanduan * @DateTime 2016-12-08T14:17:29+0800 * @param {[Object]} agent [agent.name, agent.age, agent.sex] * @return {[]} [description] */function sayHello2(agent){ console.log(agent.name); console.log(agent.age); console.log(agent.sex);}
添加回答
举报
0/150
提交
取消