Forwarding `return()` in generators

Allen Wirfs-Brock allen at wirfs-brock.com
Fri Mar 27 07:41:01 UTC 2015


> On Mar 26, 2015, at 10:50 PM, Axel Rauschmayer <axel at rauschma.de> wrote:
> 
> `return()` being optional is true for arrays:
> 
> ...
> 
> But it is not true for generators:


but it is...


> 
> ```js
> function* elements() {
>     yield 'a';
>     yield 'b';
>     yield 'c';
> }

```js
elements.prototype.return = undefined;
```

Allen



More information about the es-discuss mailing list