Something like `var foo = {}; foo.bar ||= 3` would be very useful.
But not sure how something like `obj['name']['maxlength']` be reduced to
shorthand check if 'name' is not defined.
--
*'I am what I am because of who we all are'*
h3manth.com http://www.h3manth.com
*-- Hemanth HM *
notation for attribute creation?
Unless I misunderstood your idea, `||=` makes me naturally think about
`+=` so if
`i += n;` means `i = i + n`
then
`o.name ||= value` means `o.name = o.name || value`
and this would be, according with all these years in ES3, the least
surprising behavior
[mailto:es-discuss-boun...@mozilla.org] On Behalf Of
Andrea Giammarchi
Sent: Sunday, February 9, 2014 15:29
To: Hemanth H.M
Cc: es-discuss
Subject: Re: shorthand notation for attribute creation?
Unless I misunderstood your idea, `||=` makes me naturally think about
`+=` so if
`i += n;` means `i = i
Giammarchi
Sent: Sunday, February 9, 2014 15:29
To: Hemanth H.M
Cc: es-discuss
Subject: Re: shorthand notation for attribute creation?
Unless I misunderstood your idea, `||=` makes me naturally think about
`+=` so if
`i += n;` means `i = i + n`
then
`o.name ||= value` means `o.name
4 matches
Mail list logo