-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
for (const name of ["a","b","c"]) {
Foo.prototype[name] = function () {
};
};
The anonymous function is resolved to the name Foo.prototype which is not quite correct. In this case best we could do is Foo.prototype[name].
In case the thing in brackets is a literal, we can also put that in there, if its a valid identifier, we can also convert it back to a "normal" property:
Foo.prototype[1]->Foo.prototype[1]Foo.prototype["not a valid ident"]->Foo.prototype["not a valid ident"]Foo.prototype["valid_ident"]->Foo.prototype.valid_ident
Metadata
Metadata
Assignees
Labels
No labels