I have code like this I want to look at all of the classes in my application’s universe, and when I find one that descends from Animal, I want to create a new object of that type and add it to the list. This allows me to add functionality without having to update a list of things. So I can
Tag: ecmascript-harmony
Methods in ES6 objects: using arrow functions
In ES6, both of these are legal: and, as shorthand: Is it possible to use the new arrow functions as well? In trying something like or I get an error message suggesting that the method does not have access to this. Is this just a syntax issue, or can you not use fat-arrow methods inside of ES6 objects? Answer Arrow
One-liner to take some properties from object in ES 6
How one can write a function, which takes only few attributes in most-compact way in ES6? I’ve came up with solution using destructuring + simplified object literal, but I don’t like that list of fields is repeated in the code. Is there an even slimmer solution? Answer Here’s something slimmer, although it doesn’t avoid repeating the list of fields. It
Is it possible to reset an ECMAScript 6 generator to its initial state?
Given the provided (very simple) generator, is it possible to return the generator back to its original state to use again? I would like to be able to pass the iterable off to some other scope, iterate over it, do some other stuff, then be able to iterate over it again later on in that same scope. Answer If your