Hello
I was wondering if it is possible to pass a variable by reference in JavaScript.
I was looking for it in my book, but couldn't find it.
Here is what I am trying to do:
I would param to change to 'Failure' if the condition is true.Code:var param = 'Success'; test(param); function test(param) { param = 'Success'; if (condition1) { param = 'Failure'; return; } // return some value } alert(param);
I cannot use the return value, because it is used to return a valid value from the function.
I don't want to use global variables
thanks









Bookmarks