I'm having the following error: "Myfunction is not defined"
With the structure below:
var myobject = object.extend({
init: function () {
minhafuncao();
},
minhafuncao: function() {
console.log("oi");
}
});
I'm having the following error: "Myfunction is not defined"
With the structure below:
var myobject = object.extend({
init: function () {
minhafuncao();
},
minhafuncao: function() {
console.log("oi");
}
});
Use this
to indicate the scope of the function:
var obj = {
init: function() {
this.minhafuncao();
},
minhafuncao: function() {
console.log("oi");
}
}
obj.init();