2011/9/7 Dmitry Pashkevich <[email protected]>: > On Wednesday, September 7, 2011 2:57:17 PM UTC+4, Dmitry A. Soshnikov wrote: >> >> And this variable is not read-only, you may assign to it >> (while cannot to function's name). > > But I can do this: > function x() {}; > x = 123; > x; // 123 > > I just can't understand the environment that takes place when the code > inside the function executes (in the original post) > !function x(){x=123;alert(x);}()
This is a totally different scenario. In case it is a function expression then the name is only available INSIDE the function, not outside of it (except for IE, which has a broken implementation of the spec). Read Dmitry Soshnikov's explanation on the subject. http://dmitrysoshnikov.com/ecmascript/chapter-5-functions/#function-expression -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
