Javascript destructuring for named parameters

published May 28, 2016 02:12   by admin ( last modified May 28, 2016 02:12 )

Here is one way, adapted from 11. Parameter handling :

function selectEntries({ start, end, step }) {
    console.log(end)
}

can be called like this:

selectEntries({end:7})
>> 7

In node 5.7.0 use the flag:

--harmony_destructuring