Is there a way to provide named parameters in a function call in JavaScript?

前端 未结 10 1717
抹茶落季
抹茶落季 2020-11-22 07:28

I find the named parameters feature in C# quite useful in some cases.

calculateBMI(70, height: 175);

What can I use if I want this in JavaS

10条回答
  •  既然无缘
    2020-11-22 07:33

    No - the object approach is JavaScript's answer to this. There is no problem with this provided your function expects an object rather than separate params.

提交回复
热议问题