Quantcast
Viewing all articles
Browse latest Browse all 12

Partial default arguments

Hemanth HM wrote:

var userInfo = (info= {
  name: 'Mr.Coder',
  codes: ['js','python','ruby','perl']
}) => console.log(info);

userInfo({
  name: 'ljharb'
});

Would log: {name: 'ljharb'} would it make sense to maintain the codes key as is?

That is to result in: {name: 'ljharb', codes: ['js', 'python', 'ruby', 'perl']}

Read full topic


Viewing all articles
Browse latest Browse all 12

Trending Articles