将 'a' 作为此箭头函数的输入是错误的吗?

Is this an error to have 'a' as the input for this arrow function?

来自 你不知道 JS - this 和 Object 原型,作者 Kyle Simpson,第 32 页,标题 Lexical this:

function foo() {
    return (a) => {
        console.log(this.a);
    };
}

var obj1 = {
    a:2
}

var obj2 = {
    a:3
}

var bar = foo.call(obj1);
bar.call(obj2); // 2, not 3!

这里的重点是这个返回的箭头函数将从函数 foo 继承词法 this

我不明白的是为什么上面这个箭头函数的输入是a

将 'a' 作为箭头函数的输入有什么意义?

What is the point of having 'a' as the input to the arrow function?

正如你所说,它是一个从未使用过的变量声明。

毫无意义。

ESLint 报告:

'a' is defined but never used. (no-unused-vars)