Return value of 'eval("function z() {...}"'?

Dave Fugate dfugate at microsoft.com
Thu Feb 24 17:31:59 PST 2011


Thanks for the info guys!  I was aware of 15.1.2.1, but had no idea what a FunctionDeclaration would actually evaluate to.

My best,

Dave

-----Original Message-----
From: Allen Wirfs-Brock [mailto:allen at wirfs-brock.com] 
Sent: Thursday, February 24, 2011 3:37 PM
To: mikesamuel at gmail.com
Cc: Dave Fugate; es-discuss at mozilla.org
Subject: Re: Return value of 'eval("function z() {...}"'?

And 15.1.2.1 says what eval returns if programs that evaluate to  (normal,empty, emtry): undefined.

On Feb 24, 2011, at 3:24 PM, Mike Samuel wrote:

> Nothing.
> 
> From chapter 14:
> 
> The production SourceElement : FunctionDeclaration is evaluated as
> follows: 1.	Return (normal, empty, empty).
> 
> 2011/2/24 Dave Fugate <dfugate at microsoft.com>:
>> By ES5.1, what would we expect to be 'x' in the following snippet:
>> 
>>                 x = eval("function z() {return 1;}");
>> 
>> 
>> 
>> 'undefined', 'z', or something else entirely?
>> 
>> 
>> 
>> Thanks!
>> 
>> 
>> 
>> Dave
>> 
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>> 
>> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss




More information about the es-discuss mailing list