I'm trying to call a function from this:
var _coll = [new Obj('a', somefunction)];
function Obj(id, fn) {
this.id = id;
this.fn = fn;
}
var somefunction = (function () {
return {
innerFn: function (a) {
return a
}
}
})();
//this works
var test = new Obj('a', somefunction);
alert(test.fn.innerFn('test'));
//this is not working
loopArray();
function loopArray()
for (var it in _coll) {
for (var its in _coll[it]) {
var response = _coll[it].fn.innerFn('hey');
alert(response);
}
}
}
If I change _coll to "var test=new Obj('a','somefunction');", its ok, but how do I call a function?