为了账号安全,请及时绑定邮箱和手机立即绑定

js 传参方式哪个更好?应该如何选择?

js 传参方式哪个更好?应该如何选择?

繁花不似锦 2018-10-17 10:09:38
以下两种传参的方式哪个更好?/** * [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);}
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 560 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信