Standard conventions for indicating a function argument is unused in JavaScript

前端 未结 5 963
失恋的感觉
失恋的感觉 2020-11-28 14:19

Are there any standard ways of marking a function argument as unused in JavaScript, analogous to starting a method argument with an underscore in Ruby?

5条回答
  •  再見小時候
    2020-11-28 14:56

    How about using the function arguments object?

    function third() { const [,,thirdArg] = arguments;
      return thirdArg;
    }
    console.log(third(1,2,3));

提交回复
热议问题