overriding function in function shows up as error.

Topics: General
Oct 5, 2012 at 10:13 AM

When changing a function from inside of a function causes the error
"the lefthand side of an assignment expresssion must be a variable , propperty or index".  
A example:

function example (){

   if(true){
      example = function (){alert("hi")};
   }else{
      example = function (){alert("omg")};
   }
   return example();
}

this error makes "no sense",[depending on view of what a function is],  and this is a very nice pattern to use 1 function, which can act differently, for whatever reason.

Coordinator
Oct 5, 2012 at 3:42 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.