Is there anything bad about attaching a variable to a function in Javascript? -


I am writing some javascript code and I need to keep track of a global situation the state has changed to only one function It is necessary to be widely accessible with other functions.

I am currently doing this in this way:

  function Foo (bar) {var self = arguments.callee; If (! Self Stated) {self.state = 0; // is called 0 times} else {self.state ++; // Many times I have been called}}  

Is it sensible to force such a function into a global state? This is a nifty but I am worried that I have something dangerous which I have forgotten. There is nothing wrong with assigning properties to the object function. What should you worry about it? That arguments.callee has been deprecated in ECMAScript 5, which is the language specification that is currently making its way into the mainstream browser, in strict mode, arguments Referring to callee would be an error.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -