I'm having some trouble accessing variables within my object.
I'm getting returned undefined when I try to access the variables.
My code looks like this:
var app = {
data: function() {
this.labels = [1, 2, 3, 4, 5];
},
barChartData: {
labels: this.labels, // this is undefined
datasets: [{
data: this.data1 // this is undefined
}, {
data: this.data2 // this is undefined
}]
},
},
init: function() {
this.data();
}
}
app.init();