Seeking for champion
Hi,
to be honest I don't see much of a difference between
for (const item of multi[^alt]) …
const arr = [...multi[^other]];
and
for (const item of multi.alt()) …
const arr = [...multi.other()];
So where exactly is the benefit?
I'd say a quick switch of default iterator implementation. Adding an alias for a generator function. Skipping misleading function call as well.
Related question, is it possible to alias a function?
class Foo
{
*bar() {}
*baralias() (this.bar)
// Normally used like
*barnormal() { return this.bar.bind(this); }
}
The function call is not misleading at all, why do you think it is confusing?
Sure, you can just write
class Foo {
*bar() { … }
get alias() { return this.bar }
}
or
Foo.prototype.anotherAlias = Foo.prototype.bar;
1 Like