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

前端 未结 10 1900
抹茶落季
抹茶落季 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条回答
  •  猫巷女王i
    2020-11-22 07:31

    Coming from Python this bugged me. I wrote a simple wrapper/Proxy for node that will accept both positional and keyword objects.

    https://github.com/vinces1979/node-def/blob/master/README.md

提交回复
热议问题