Global functions
John Resig
jresig at mozilla.com
Thu Dec 13 17:25:43 PST 2007
I was under the impression that for the function definitions to be confined to a block scope, you had to define them as such (with let function statements), like so:
package {
{
let function fun() {
print("1");
}
fun()
}
{
let function fun() {
print("2")
}
fun()
}
}
I'm unsure if this currently works in the RI, or not.
--John
----- Original Message -----
From: "Michael O'Brien" <mob at mbedthis.com>
To: "es4-discuss" <es4-discuss at mozilla.org>
Sent: Thursday, December 13, 2007 7:10:41 PM (GMT-0500) America/New_York
Subject: Global functions
Are global functions declared with block or global scope. ie. declared
in the block object or var object?
Consider:
package {
{
function fun() {
print("1");
}
fun()
}
{
function fun() {
print("2")
}
fun()
}
}
This prints
2
2
in the RI.
So should functions be treated like var declarations or as let
declarations. Seems like they are like vars in the RI.
Is this right?
Michael O'Brien
_______________________________________________
Es4-discuss mailing list
Es4-discuss at mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss
More information about the Es4-discuss
mailing list