I have this code and I am trying to access 'model' array with '_currentModel' object.
// an array I want to access
var model = [
{
name:'haha',
image:'cat1.jpg',
count: 0
},
{
name: 'pew',
image: 'cat2.jpg',
count: 0
},
{
name: 'wow',
image: 'cat3.jpg',
count: 0
}
];
the object that should access it:
var _currentModel = {
index: 0,
name: model[this.index].name, //error: model[this.index] is undefined
image: model[_currentModel.index].image, //error: _currentModel is undefined
count: model[_currentModel.index].count //error: _currentModel is undefined
}