I apologize, if this is a dublicate, but I can't find the answer I am looking for, although my problem seems to be easy.
This is what I have:
function myMain (myParam) {
var myObj = {
myVal1 : 'demo',
myFunc : function (myParam) {
console.log (myParam);
}
};
runDemo(myObj);
}
My problem is that I want the console.log to write myParam of myMain, but it is undefined - why?
How can I call myMain('works') so that console writes works?
FYI: runDemo has too be called with this single Object and with myFunc as one of the objects values - no way around that. I am grateful for any help, thanks.