Here is my code:
myExt = {};
myExt.Panel = function (config){
var d = document.createElement("div");
/*Do something (a lot) with config and d here
// a lot of code here
*/
return
{
div:d,
events:e,
customattribs:ca
};
}
Here is my caller:
var p = new myExt.Panel({
id:'parent',
events:{
onload:function(){
alert("onload");
}
},
//more configs
});
if I do
console.log(p)
I get null. Please help me debug the problem.
Automatic semicolon insertion has turned the return value of your function from:
into:
It would be better if you stored the value you want to return in a variable, and then return that object: