I declared a global:
var myClient;
I have a function:
//Contact is a record object that has toString() which prints the name.
function getClient() {
myClient = new Object();
debug(input.contact); // This prints properly
myClient.contact = input.contact;
debug(myClient.contact); // This prints properly
}
I have another function that is trying to use the same:
function dispatchClient() {
debug(myClient.contact);
}
And the result I see is undefined. Is something wrong here? (Ignoring the design aspect)
If that is wrong, then how can I pass the state of global between functions? If that is not wrong, then hmm, I may need to dig deeper!
inputis defined.myclientandmyClientare different names.getClient()before you calldispatchClient()? This works fine: jsfiddle.net/f7xbK.