Try the following code. Hope it will fulfill your requirement..
function ObjectAlert(a,b,c){
var obj = {};
obj.name = a;
obj.location = b;
obj.shout= function (){alert(c);};
return obj.shout();
}
ObjectAlert("jake","here","alert");
Or, you can try the following..
function ObjectAlert(a,b,c){
var obj = {};
obj.name = a;
obj.location = b;
obj.shout= function (){alert(c);};
return obj;
}
ObjectAlert("jake","here","alert").shout();
And, also can try this..
function ObjectAlert(a,b,c){
var obj = {};
obj.name = a;
obj.location = b;
obj.shout= function (){alert(c);};
return obj;
}
var shout = ObjectAlert("jake","here","alert");
shout.shout();