如何使用JavaScript避免使用未使用的变量?

Pom*_*eyo 5 javascript jquery

什么是一个好的JavaScript技术/约定/标准要避免unused variables

例如,如果我正在调用下面的函数并且我只想使用第3个参数,那么我该如何处理第1和第2个参数?

$.ajax({
    success: function(first, second, third){
        console.log("just using: " + third);
    }
});
Run Code Online (Sandbox Code Playgroud)

Que*_*tin 3

别理他们。

(您可以将函数定义为function () {然后使用var third = arguments[2];,但这并不适合非常可读的代码)。