Open
Description
Description
Check for the methods from
, every
, filter
, find
, findIndex
, forEach
, map
and some
that the parameter doesn't have a .bind(foo)
(and prefer the use of the parameter thisArg
).
Example
https://jsbin.com/neleqiwiha/edit?js,console
class Foo {
#bar = "b";
filter(element) {
return this.#bar === element;
}
main() {
console.log(["a", "b", "c"].filter(this.filter.bind(this)));
console.log(["a", "b", "c"].filter(this.filter, this));
}
};
const foo = new Foo();
foo.main();
Metadata
Metadata
Assignees
Labels
No labels