Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Named-parameters/JavaScript/named-parameters-2.js
Normal file
12
Task/Named-parameters/JavaScript/named-parameters-2.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
let
|
||||
example = // The member name in the object can either be the same as the parameter (as in bar, grill),
|
||||
// or a different parameter name as in the case of member foo being assigned to parameter a here.
|
||||
({foo: a=0, bar=1, grill='pork chops'}={}) => (
|
||||
console.log('foo is ',a,', bar is ',bar,', and grill is '+grill));
|
||||
|
||||
example();
|
||||
// foo is 0 , bar is 1 , and grill is pork chops
|
||||
example({grill: "lamb kebab", bar: 3.14});
|
||||
// foo is 0 , bar is 3.14 , and grill is lamb kebab
|
||||
example({foo:null});
|
||||
// foo is , bar is 1 , and grill is pork chops
|
||||
Loading…
Add table
Add a link
Reference in a new issue