Object literal methods and generator

Herby Vojčík herby at mailbox.sk
Fri Jan 13 02:15:43 PST 2012


Hello!

In object literal, one can define method by
    method (args) {
      body
    }
which is nice shortcut for 'method: function (args) { body },' with added 
value of method being non-enumerable. But there is no shortcut for 'gen: 
function* (args) { body },'.

What about extending the object literal notation with
    *method (args) {
      body
    }
to define a generator method?

Herby



More information about the es-discuss mailing list