On 23 August 2011 14:01, Rahul <[email protected]> wrote: > but when the line > createUniqueId.counter = 1; > is executed still the function createUniqueId is not created, so at > that point where does the createUniqueId.counter is registered, >
You're dealing with function hoisting here: http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting The function declaration `createUniqueId` is effectively hoisted to the top of the script, so it actually *is* defined before you add the `counter` property to it. -- Nick Morgan http://skilldrick.co.uk @skilldrick Save our in-boxes! http://emailcharter.org -- 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]
