Send a variable to a variable of a function?
Posted
by
J. M
on Stack Overflow
See other posts from Stack Overflow
or by J. M
Published on 2010-12-26T03:34:56Z
Indexed on
2010/12/26
3:53 UTC
Read the original article
Hit count: 167
JavaScript
Let's say I have a function and one of the parameters is for the name of the target variable.. Would it be possible for me to send a variable to the function like this:
function otherfunction(input){
...
}
function test {target) {
var x = 1;
target(x);
}
test(otherfunction);
The problem I have is that I'm making a greasemonkey script and one of the variable I need can't be returned from the function due to a limitation.. So this would be the alternative. I just don't know how to get it to work.. Any help would be much appreciated!!
© Stack Overflow or respective owner