Where can I get info on the object parameter syntax for JavaScript functions?

前端 未结 1 1288
离开以前
离开以前 2020-11-22 03:46

If I want to call a function like this:

moo({ a: 4 });

Normally I\'d have to phrase my function definition like this:

funct         


        
1条回答
  •  忘了有多久
    2020-11-22 04:12

    It's called destructuring. You might find the most info at MDN: Destructuring assignment (especially see Unpacking fields from objects passed as function parameter).


    The ECMAScript standards discussion can be found on their wiki page, also interesting might be this blog post at dailyjs.

    0 讨论(0)
提交回复
热议问题