Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 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