On Dec 4, 11:17 am, yoshi <[EMAIL PROTECTED]> wrote:
> heres my js:
>
> var stuff7=eval('function() {alert("stuff..");}')
>
> when i alert stuff7 it is undefined.
The code passed to eval is treated at a function declaration. Without
a name, it is a syntax error.
>
> now if i do this:
> eval('var stuff7=function() {alert("stuff..");}')
>
> and alert stuff7, it is defined
Because now it is a valid function expression. You could also use a
valid function declaration:
eval('function stuff7() {alert("stuff..");}')
> does anybody know y, the jscript eval doc doesnt really help,
No surprises there, it is a user guide, not a specification. Use
ECMA-262, section 10.2.2.
> i suspect it is a scope issue?
It's a syntax error.
--
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---