Operators ||= and &&=
liorean
liorean at gmail.com
Tue May 5 12:16:12 PDT 2009
> On Tue, May 5, 2009 at 11:37 AM, Peter Michaux <petermichaux at gmail.com> wrote:
>> function(a=1, b="defaultVal");
>>
>> And in this syntax will default values be used if the parameter is
>> falsey or only if it is undefined?
2009/5/5 Mark S. Miller <erights at google.com>:
> Or only if it is absent?
I've been out of the ECMAScript world for many months now, but IIRC in
ES3 all formal parameters that are absent gets initiated to the value
undefined. Not sure which side of the function call border that
initiation takes place on, though. Wouldn't special casing absence
from undefined value effectively introduce another state for a
variable to be in, though, since the behaviour is indistinguishable in
user code in ES3?
--
David "liorean" Andersson
More information about the es-discuss
mailing list