Hi i'm trying to get the refence to the attribute name in that declaration but when i print this.name
inside fun attribute (function definition), of my object it doesn't work, instead when i use this.name
in this.img
attribute, it works.
why?
here's my code
var submenu = new function(){
this.name = museum[i].name,
this.title = 'It will merge row',
this.img =img/this.name + '.png', //it work
this.fun = function (data) {
console.log(this.name); //it doesn't work
}
};
it prints undeclared....