Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[js] 第644天 写一个函数时,如果有多个参数,如何传才比较好? #3457

Open
haizhilin2013 opened this issue Jan 18, 2021 · 2 comments
Labels
js JavaScript

Comments

@haizhilin2013
Copy link
Collaborator

第644天 写一个函数时,如果有多个参数,如何传才比较好?

3+1官网

我也要出题

@haizhilin2013 haizhilin2013 added the js JavaScript label Jan 18, 2021
@xujs0813
Copy link

使用对象传递参数,利用解构为参数设置默认值
function foo({arg1=1, arg2=2, }={})

@Aizener
Copy link

Aizener commented Jan 21, 2021

  1. 用对象传;
  2. 用扩展运算符;
  3. 利用arguments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
js JavaScript
Projects
None yet
Development

No branches or pull requests

3 participants