Reputation: 1147
I have an model object;
building= model("tb_buildings");
building.myFunction() = function(){return false;};
Initially this object has no methods, I am trying to created a method for it called myFunction() and assign it a value of false; I tried the anonymous function approach but it give me an error;
Cannot assign a value to a function
Is this possible?
Upvotes: 1
Views: 188
Reputation: 11120
To set a variable to be a function you should
building.myFunction = function(){ return false; };
Upvotes: 8