ES6 destructuring function parameter - naming root object










15















Is there a way to retain the name of a destructured function argument? I.e., the name of the root object?



In ES5, I might do this (using inheritance as a metaphor to make the point):



// ES5:
var setupParentClass5 = function(options)
textEditor.setup(options.rows, options.columns);
;

var setupChildClass5 = function(options)
rangeSlider.setup(options.minVal, options.maxVal);
setupParentClass5(options); // <= we pass the options object UP
;


I'm using the same options object to hold multiple configuration parameters. Some parameters are used by the parent class, and some are used by the subclass.



Is there a way to do this with destructured function arguments in ES6?



// ES6:
var setupParentClass6 = (rows, columns) =>
textEditor.setup(rows, columns);
;

var setupChildClass6 = (minVal, maxVal) =>
rangeSlider.setup(minVal, maxVal);
setupParentClass6( /* ??? */ ); // how to pass the root options object?
;


Or do I need to extract all of the options in setupChildClass6() so that they can be individually passed into setupParentClass6()?



// ugh.
var setupChildClass6b = (minVal, maxVal, rows, columns) =>
rangeSlider.setup(minVal, maxVal);
setupParentClass6(rows, columns);
;









share|improve this question






















  • arguments[0] would do, but no, you cannot name them at the same time as destructuring.

    – Bergi
    Oct 17 '15 at 11:24















15















Is there a way to retain the name of a destructured function argument? I.e., the name of the root object?



In ES5, I might do this (using inheritance as a metaphor to make the point):



// ES5:
var setupParentClass5 = function(options)
textEditor.setup(options.rows, options.columns);
;

var setupChildClass5 = function(options)
rangeSlider.setup(options.minVal, options.maxVal);
setupParentClass5(options); // <= we pass the options object UP
;


I'm using the same options object to hold multiple configuration parameters. Some parameters are used by the parent class, and some are used by the subclass.



Is there a way to do this with destructured function arguments in ES6?



// ES6:
var setupParentClass6 = (rows, columns) =>
textEditor.setup(rows, columns);
;

var setupChildClass6 = (minVal, maxVal) =>
rangeSlider.setup(minVal, maxVal);
setupParentClass6( /* ??? */ ); // how to pass the root options object?
;


Or do I need to extract all of the options in setupChildClass6() so that they can be individually passed into setupParentClass6()?



// ugh.
var setupChildClass6b = (minVal, maxVal, rows, columns) =>
rangeSlider.setup(minVal, maxVal);
setupParentClass6(rows, columns);
;









share|improve this question






















  • arguments[0] would do, but no, you cannot name them at the same time as destructuring.

    – Bergi
    Oct 17 '15 at 11:24













15












15








15


3






Is there a way to retain the name of a destructured function argument? I.e., the name of the root object?



In ES5, I might do this (using inheritance as a metaphor to make the point):



// ES5:
var setupParentClass5 = function(options)
textEditor.setup(options.rows, options.columns);
;

var setupChildClass5 = function(options)
rangeSlider.setup(options.minVal, options.maxVal);
setupParentClass5(options); // <= we pass the options object UP
;


I'm using the same options object to hold multiple configuration parameters. Some parameters are used by the parent class, and some are used by the subclass.



Is there a way to do this with destructured function arguments in ES6?



// ES6:
var setupParentClass6 = (rows, columns) =>
textEditor.setup(rows, columns);
;

var setupChildClass6 = (minVal, maxVal) =>
rangeSlider.setup(minVal, maxVal);
setupParentClass6( /* ??? */ ); // how to pass the root options object?
;


Or do I need to extract all of the options in setupChildClass6() so that they can be individually passed into setupParentClass6()?



// ugh.
var setupChildClass6b = (minVal, maxVal, rows, columns) =>
rangeSlider.setup(minVal, maxVal);
setupParentClass6(rows, columns);
;









share|improve this question














Is there a way to retain the name of a destructured function argument? I.e., the name of the root object?



In ES5, I might do this (using inheritance as a metaphor to make the point):



// ES5:
var setupParentClass5 = function(options)
textEditor.setup(options.rows, options.columns);
;

var setupChildClass5 = function(options)
rangeSlider.setup(options.minVal, options.maxVal);
setupParentClass5(options); // <= we pass the options object UP
;


I'm using the same options object to hold multiple configuration parameters. Some parameters are used by the parent class, and some are used by the subclass.



Is there a way to do this with destructured function arguments in ES6?



// ES6:
var setupParentClass6 = (rows, columns) =>
textEditor.setup(rows, columns);
;

var setupChildClass6 = (minVal, maxVal) =>
rangeSlider.setup(minVal, maxVal);
setupParentClass6( /* ??? */ ); // how to pass the root options object?
;


Or do I need to extract all of the options in setupChildClass6() so that they can be individually passed into setupParentClass6()?



// ugh.
var setupChildClass6b = (minVal, maxVal, rows, columns) =>
rangeSlider.setup(minVal, maxVal);
setupParentClass6(rows, columns);
;






javascript function arguments ecmascript-6 destructuring






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 14 '15 at 16:02









jbxjbx

1387




1387












  • arguments[0] would do, but no, you cannot name them at the same time as destructuring.

    – Bergi
    Oct 17 '15 at 11:24

















  • arguments[0] would do, but no, you cannot name them at the same time as destructuring.

    – Bergi
    Oct 17 '15 at 11:24
















arguments[0] would do, but no, you cannot name them at the same time as destructuring.

– Bergi
Oct 17 '15 at 11:24





arguments[0] would do, but no, you cannot name them at the same time as destructuring.

– Bergi
Oct 17 '15 at 11:24












3 Answers
3






active

oldest

votes


















9














I have the 'options' arguments on too many places myself. I would opt for 1 extra line of code. Not worthy in this example, but a good solution when having destructuring on more lines.



const setupChildClass6 = options => 
const minVal, maxVal = options;
rangeSlider.setup(minVal, maxVal);
setupParentClass6(options);
;





share|improve this answer

























  • Agreed -- this is what I've been using as well. We've all learned to use es6 much better in the last few months!

    – jbx
    Dec 9 '15 at 16:58


















7














You cannot do it directly in the arguments, but you can extract the values afterward:



function myFun(allVals) 
const val1, val2, val3 = allVals;
console.log("easy access to individual entries:", val2);
console.log("easy access to all entries:", allVals);






share|improve this answer

























  • And even better, you can use const here :-)

    – Bergi
    Oct 17 '15 at 11:25











  • Oh but that may depends on what he wants to do with them, don't you think?

    – Quentin Roy
    Oct 17 '15 at 11:28











  • Well there are many people who argue that const should be the default. Of course if you wish to reassign, you'd need let.

    – Bergi
    Oct 17 '15 at 12:28











  • Oh. Ok it makes sense. I'll do an update.

    – Quentin Roy
    Oct 17 '15 at 13:46











  • tl;dr poor intellisense. The problem with this approach is that you won't have any indication of allVals structure when using myFun

    – Romain Vincent
    9 hours ago


















5














You cannot use destructuring and simple named positional argument for the same parameter at the same time. What you can do:




  1. Use destructuring for setupParentClass6 function, but old ES6 approach for setupChildClass6 (I think this is the best choice, just make name shorter):



    var setupChildClass6 = (o) => 
    rangeSlider.setup(o.minVal, o.maxVal);
    setupParentClass6(o);
    ;



  2. Use old arguments object. But arguments can slow down a function (V8 particular), so I think it's a bad approach:



    var setupChildClass6 = (minVal, maxVal) => 
    rangeSlider.setup(minVal, maxVal);
    setupParentClass6(arguments[0]);
    ;



  3. ES7 has proposal for rest/spread properties (if you don't need minVal and maxVal in setupParentCalss6 function):



    var setupChildClass6b = (minVal, maxVal, ...rest) => 
    rangeSlider.setup(minVal, maxVal);
    setupParentClass6(rest);
    ;


    Unfortunately it's not ES6.







share|improve this answer























  • Thanks, super-helpful. Actually #2 is closest to the intention, and the slowdown will not be relevant given how the function is used. For the moment, I'm using Babel, so perhaps it will get rest properties on objects soon.

    – jbx
    Mar 16 '15 at 21:27






  • 2





    The usage of arguments as shown in #2 actually is not slow. But I'd consider it unreadable.

    – Bergi
    Dec 7 '15 at 21:44






  • 1





    Rest properties might not solve your problem, as it does take minVal and maxVal out of the options objects. Beware.

    – Bergi
    Dec 7 '15 at 21:45











  • can you elaborate on why and how much using arguments would slow down the function?

    – Romain Vincent
    9 hours ago










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f29051011%2fes6-destructuring-function-parameter-naming-root-object%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes









9














I have the 'options' arguments on too many places myself. I would opt for 1 extra line of code. Not worthy in this example, but a good solution when having destructuring on more lines.



const setupChildClass6 = options => 
const minVal, maxVal = options;
rangeSlider.setup(minVal, maxVal);
setupParentClass6(options);
;





share|improve this answer

























  • Agreed -- this is what I've been using as well. We've all learned to use es6 much better in the last few months!

    – jbx
    Dec 9 '15 at 16:58















9














I have the 'options' arguments on too many places myself. I would opt for 1 extra line of code. Not worthy in this example, but a good solution when having destructuring on more lines.



const setupChildClass6 = options => 
const minVal, maxVal = options;
rangeSlider.setup(minVal, maxVal);
setupParentClass6(options);
;





share|improve this answer

























  • Agreed -- this is what I've been using as well. We've all learned to use es6 much better in the last few months!

    – jbx
    Dec 9 '15 at 16:58













9












9








9







I have the 'options' arguments on too many places myself. I would opt for 1 extra line of code. Not worthy in this example, but a good solution when having destructuring on more lines.



const setupChildClass6 = options => 
const minVal, maxVal = options;
rangeSlider.setup(minVal, maxVal);
setupParentClass6(options);
;





share|improve this answer















I have the 'options' arguments on too many places myself. I would opt for 1 extra line of code. Not worthy in this example, but a good solution when having destructuring on more lines.



const setupChildClass6 = options => 
const minVal, maxVal = options;
rangeSlider.setup(minVal, maxVal);
setupParentClass6(options);
;






share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 17 '18 at 15:25

























answered Dec 7 '15 at 21:26









Niels SteenbeekNiels Steenbeek

3,56723041




3,56723041












  • Agreed -- this is what I've been using as well. We've all learned to use es6 much better in the last few months!

    – jbx
    Dec 9 '15 at 16:58

















  • Agreed -- this is what I've been using as well. We've all learned to use es6 much better in the last few months!

    – jbx
    Dec 9 '15 at 16:58
















Agreed -- this is what I've been using as well. We've all learned to use es6 much better in the last few months!

– jbx
Dec 9 '15 at 16:58





Agreed -- this is what I've been using as well. We've all learned to use es6 much better in the last few months!

– jbx
Dec 9 '15 at 16:58













7














You cannot do it directly in the arguments, but you can extract the values afterward:



function myFun(allVals) 
const val1, val2, val3 = allVals;
console.log("easy access to individual entries:", val2);
console.log("easy access to all entries:", allVals);






share|improve this answer

























  • And even better, you can use const here :-)

    – Bergi
    Oct 17 '15 at 11:25











  • Oh but that may depends on what he wants to do with them, don't you think?

    – Quentin Roy
    Oct 17 '15 at 11:28











  • Well there are many people who argue that const should be the default. Of course if you wish to reassign, you'd need let.

    – Bergi
    Oct 17 '15 at 12:28











  • Oh. Ok it makes sense. I'll do an update.

    – Quentin Roy
    Oct 17 '15 at 13:46











  • tl;dr poor intellisense. The problem with this approach is that you won't have any indication of allVals structure when using myFun

    – Romain Vincent
    9 hours ago















7














You cannot do it directly in the arguments, but you can extract the values afterward:



function myFun(allVals) 
const val1, val2, val3 = allVals;
console.log("easy access to individual entries:", val2);
console.log("easy access to all entries:", allVals);






share|improve this answer

























  • And even better, you can use const here :-)

    – Bergi
    Oct 17 '15 at 11:25











  • Oh but that may depends on what he wants to do with them, don't you think?

    – Quentin Roy
    Oct 17 '15 at 11:28











  • Well there are many people who argue that const should be the default. Of course if you wish to reassign, you'd need let.

    – Bergi
    Oct 17 '15 at 12:28











  • Oh. Ok it makes sense. I'll do an update.

    – Quentin Roy
    Oct 17 '15 at 13:46











  • tl;dr poor intellisense. The problem with this approach is that you won't have any indication of allVals structure when using myFun

    – Romain Vincent
    9 hours ago













7












7








7







You cannot do it directly in the arguments, but you can extract the values afterward:



function myFun(allVals) 
const val1, val2, val3 = allVals;
console.log("easy access to individual entries:", val2);
console.log("easy access to all entries:", allVals);






share|improve this answer















You cannot do it directly in the arguments, but you can extract the values afterward:



function myFun(allVals) 
const val1, val2, val3 = allVals;
console.log("easy access to individual entries:", val2);
console.log("easy access to all entries:", allVals);







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 30 at 22:07

























answered Oct 17 '15 at 10:49









Quentin RoyQuentin Roy

5,08911942




5,08911942












  • And even better, you can use const here :-)

    – Bergi
    Oct 17 '15 at 11:25











  • Oh but that may depends on what he wants to do with them, don't you think?

    – Quentin Roy
    Oct 17 '15 at 11:28











  • Well there are many people who argue that const should be the default. Of course if you wish to reassign, you'd need let.

    – Bergi
    Oct 17 '15 at 12:28











  • Oh. Ok it makes sense. I'll do an update.

    – Quentin Roy
    Oct 17 '15 at 13:46











  • tl;dr poor intellisense. The problem with this approach is that you won't have any indication of allVals structure when using myFun

    – Romain Vincent
    9 hours ago

















  • And even better, you can use const here :-)

    – Bergi
    Oct 17 '15 at 11:25











  • Oh but that may depends on what he wants to do with them, don't you think?

    – Quentin Roy
    Oct 17 '15 at 11:28











  • Well there are many people who argue that const should be the default. Of course if you wish to reassign, you'd need let.

    – Bergi
    Oct 17 '15 at 12:28











  • Oh. Ok it makes sense. I'll do an update.

    – Quentin Roy
    Oct 17 '15 at 13:46











  • tl;dr poor intellisense. The problem with this approach is that you won't have any indication of allVals structure when using myFun

    – Romain Vincent
    9 hours ago
















And even better, you can use const here :-)

– Bergi
Oct 17 '15 at 11:25





And even better, you can use const here :-)

– Bergi
Oct 17 '15 at 11:25













Oh but that may depends on what he wants to do with them, don't you think?

– Quentin Roy
Oct 17 '15 at 11:28





Oh but that may depends on what he wants to do with them, don't you think?

– Quentin Roy
Oct 17 '15 at 11:28













Well there are many people who argue that const should be the default. Of course if you wish to reassign, you'd need let.

– Bergi
Oct 17 '15 at 12:28





Well there are many people who argue that const should be the default. Of course if you wish to reassign, you'd need let.

– Bergi
Oct 17 '15 at 12:28













Oh. Ok it makes sense. I'll do an update.

– Quentin Roy
Oct 17 '15 at 13:46





Oh. Ok it makes sense. I'll do an update.

– Quentin Roy
Oct 17 '15 at 13:46













tl;dr poor intellisense. The problem with this approach is that you won't have any indication of allVals structure when using myFun

– Romain Vincent
9 hours ago





tl;dr poor intellisense. The problem with this approach is that you won't have any indication of allVals structure when using myFun

– Romain Vincent
9 hours ago











5














You cannot use destructuring and simple named positional argument for the same parameter at the same time. What you can do:




  1. Use destructuring for setupParentClass6 function, but old ES6 approach for setupChildClass6 (I think this is the best choice, just make name shorter):



    var setupChildClass6 = (o) => 
    rangeSlider.setup(o.minVal, o.maxVal);
    setupParentClass6(o);
    ;



  2. Use old arguments object. But arguments can slow down a function (V8 particular), so I think it's a bad approach:



    var setupChildClass6 = (minVal, maxVal) => 
    rangeSlider.setup(minVal, maxVal);
    setupParentClass6(arguments[0]);
    ;



  3. ES7 has proposal for rest/spread properties (if you don't need minVal and maxVal in setupParentCalss6 function):



    var setupChildClass6b = (minVal, maxVal, ...rest) => 
    rangeSlider.setup(minVal, maxVal);
    setupParentClass6(rest);
    ;


    Unfortunately it's not ES6.







share|improve this answer























  • Thanks, super-helpful. Actually #2 is closest to the intention, and the slowdown will not be relevant given how the function is used. For the moment, I'm using Babel, so perhaps it will get rest properties on objects soon.

    – jbx
    Mar 16 '15 at 21:27






  • 2





    The usage of arguments as shown in #2 actually is not slow. But I'd consider it unreadable.

    – Bergi
    Dec 7 '15 at 21:44






  • 1





    Rest properties might not solve your problem, as it does take minVal and maxVal out of the options objects. Beware.

    – Bergi
    Dec 7 '15 at 21:45











  • can you elaborate on why and how much using arguments would slow down the function?

    – Romain Vincent
    9 hours ago















5














You cannot use destructuring and simple named positional argument for the same parameter at the same time. What you can do:




  1. Use destructuring for setupParentClass6 function, but old ES6 approach for setupChildClass6 (I think this is the best choice, just make name shorter):



    var setupChildClass6 = (o) => 
    rangeSlider.setup(o.minVal, o.maxVal);
    setupParentClass6(o);
    ;



  2. Use old arguments object. But arguments can slow down a function (V8 particular), so I think it's a bad approach:



    var setupChildClass6 = (minVal, maxVal) => 
    rangeSlider.setup(minVal, maxVal);
    setupParentClass6(arguments[0]);
    ;



  3. ES7 has proposal for rest/spread properties (if you don't need minVal and maxVal in setupParentCalss6 function):



    var setupChildClass6b = (minVal, maxVal, ...rest) => 
    rangeSlider.setup(minVal, maxVal);
    setupParentClass6(rest);
    ;


    Unfortunately it's not ES6.







share|improve this answer























  • Thanks, super-helpful. Actually #2 is closest to the intention, and the slowdown will not be relevant given how the function is used. For the moment, I'm using Babel, so perhaps it will get rest properties on objects soon.

    – jbx
    Mar 16 '15 at 21:27






  • 2





    The usage of arguments as shown in #2 actually is not slow. But I'd consider it unreadable.

    – Bergi
    Dec 7 '15 at 21:44






  • 1





    Rest properties might not solve your problem, as it does take minVal and maxVal out of the options objects. Beware.

    – Bergi
    Dec 7 '15 at 21:45











  • can you elaborate on why and how much using arguments would slow down the function?

    – Romain Vincent
    9 hours ago













5












5








5







You cannot use destructuring and simple named positional argument for the same parameter at the same time. What you can do:




  1. Use destructuring for setupParentClass6 function, but old ES6 approach for setupChildClass6 (I think this is the best choice, just make name shorter):



    var setupChildClass6 = (o) => 
    rangeSlider.setup(o.minVal, o.maxVal);
    setupParentClass6(o);
    ;



  2. Use old arguments object. But arguments can slow down a function (V8 particular), so I think it's a bad approach:



    var setupChildClass6 = (minVal, maxVal) => 
    rangeSlider.setup(minVal, maxVal);
    setupParentClass6(arguments[0]);
    ;



  3. ES7 has proposal for rest/spread properties (if you don't need minVal and maxVal in setupParentCalss6 function):



    var setupChildClass6b = (minVal, maxVal, ...rest) => 
    rangeSlider.setup(minVal, maxVal);
    setupParentClass6(rest);
    ;


    Unfortunately it's not ES6.







share|improve this answer













You cannot use destructuring and simple named positional argument for the same parameter at the same time. What you can do:




  1. Use destructuring for setupParentClass6 function, but old ES6 approach for setupChildClass6 (I think this is the best choice, just make name shorter):



    var setupChildClass6 = (o) => 
    rangeSlider.setup(o.minVal, o.maxVal);
    setupParentClass6(o);
    ;



  2. Use old arguments object. But arguments can slow down a function (V8 particular), so I think it's a bad approach:



    var setupChildClass6 = (minVal, maxVal) => 
    rangeSlider.setup(minVal, maxVal);
    setupParentClass6(arguments[0]);
    ;



  3. ES7 has proposal for rest/spread properties (if you don't need minVal and maxVal in setupParentCalss6 function):



    var setupChildClass6b = (minVal, maxVal, ...rest) => 
    rangeSlider.setup(minVal, maxVal);
    setupParentClass6(rest);
    ;


    Unfortunately it's not ES6.








share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 14 '15 at 16:37









alexpodsalexpods

35.7k78088




35.7k78088












  • Thanks, super-helpful. Actually #2 is closest to the intention, and the slowdown will not be relevant given how the function is used. For the moment, I'm using Babel, so perhaps it will get rest properties on objects soon.

    – jbx
    Mar 16 '15 at 21:27






  • 2





    The usage of arguments as shown in #2 actually is not slow. But I'd consider it unreadable.

    – Bergi
    Dec 7 '15 at 21:44






  • 1





    Rest properties might not solve your problem, as it does take minVal and maxVal out of the options objects. Beware.

    – Bergi
    Dec 7 '15 at 21:45











  • can you elaborate on why and how much using arguments would slow down the function?

    – Romain Vincent
    9 hours ago

















  • Thanks, super-helpful. Actually #2 is closest to the intention, and the slowdown will not be relevant given how the function is used. For the moment, I'm using Babel, so perhaps it will get rest properties on objects soon.

    – jbx
    Mar 16 '15 at 21:27






  • 2





    The usage of arguments as shown in #2 actually is not slow. But I'd consider it unreadable.

    – Bergi
    Dec 7 '15 at 21:44






  • 1





    Rest properties might not solve your problem, as it does take minVal and maxVal out of the options objects. Beware.

    – Bergi
    Dec 7 '15 at 21:45











  • can you elaborate on why and how much using arguments would slow down the function?

    – Romain Vincent
    9 hours ago
















Thanks, super-helpful. Actually #2 is closest to the intention, and the slowdown will not be relevant given how the function is used. For the moment, I'm using Babel, so perhaps it will get rest properties on objects soon.

– jbx
Mar 16 '15 at 21:27





Thanks, super-helpful. Actually #2 is closest to the intention, and the slowdown will not be relevant given how the function is used. For the moment, I'm using Babel, so perhaps it will get rest properties on objects soon.

– jbx
Mar 16 '15 at 21:27




2




2





The usage of arguments as shown in #2 actually is not slow. But I'd consider it unreadable.

– Bergi
Dec 7 '15 at 21:44





The usage of arguments as shown in #2 actually is not slow. But I'd consider it unreadable.

– Bergi
Dec 7 '15 at 21:44




1




1





Rest properties might not solve your problem, as it does take minVal and maxVal out of the options objects. Beware.

– Bergi
Dec 7 '15 at 21:45





Rest properties might not solve your problem, as it does take minVal and maxVal out of the options objects. Beware.

– Bergi
Dec 7 '15 at 21:45













can you elaborate on why and how much using arguments would slow down the function?

– Romain Vincent
9 hours ago





can you elaborate on why and how much using arguments would slow down the function?

– Romain Vincent
9 hours ago

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f29051011%2fes6-destructuring-function-parameter-naming-root-object%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線