[RESOLVED]How can I programmably set return to true or false in a function

 I would like to pass a parameter into a function that sets return to true or false like this.

function test(ReturnTrueOrFalse){

return ReturnTrueOrFalse;


How do I do that? 

You can write some condition inside test function, if that matches,, then return true else false. Else i am not clear , what you expect for this?

your example is correct. if you are trying to change the return value, without modifying the function code its

function abc() {

abc = (function() {
   var orig = abc;
   return function(someValue) {
     return someValue;


abc(true); // runs abc and returns true

Leave a Reply