Skip to content

Tag: ecmascript-6

Filter object properties by key in ES6

Let’s say I have an object: I want to create another object by filtering the object above so I have something like. I am looking for a clean way to accomplish this using Es6, so spread operators are available to me. Answer If you have a list of allowed values, you can easily retain them in an object usi…

Can there be generator getters in classes?

I mean getters that are generators. All this is ES6+ I believe. Like this maybe. That doesn’t work through, I am placing the asterisk wrong (that is if this is possible at all) unexpected identifier * Answer There is no shorthand notation for this. You can however return a generator from a getter proper…