I am new to javascript and I'm trying some different things. Take this following example:
function obj(){
this.execute = function(codeToExecute){
codeToExecute();
}
}
// Object init and function call
var obj = obj();
obj.execute(function(){
alert("G'Day!");
}
This will execute the alert message. All good until now but now I'm trying to alert a message transmitted through a parameter:
var obj = obj();
obj.execute(function(message){
alert(message);
}
What should be the structure of the function obj() now that I have to insert that parameter somewhere?
I couldn't find anything useful on google because honestly I don't know exactly what I should be looking for. Thank you!