nazwane parametry
function selectEntries({start=0, end=-1, step=1}) {
return {start, end, step};
}
Poojan Mehta
function selectEntries({start=0, end=-1, step=1}) {
return {start, end, step};
}
function example({ arg1 = 1, arg2 = 2, arg3 = 3 } = {}) {
return { arg1, arg2, arg3 };
}
function problem({failure = true}) {
return failure;
}
problem(); //TypeError: Cannot read property 'failure' of undefined
example({ arg2: 4, arg1: 2 }); // { arg1: 2, arg2: 4, arg3: 3 }
example(); // { arg1: 1, arg2: 2, arg3: 3 }