I have a simple xml file that I'm looping over to set a ValueObject for each item node. Each VO created is added to a LinkedList data structure. The linkedList is instantiated outside the .each() loop. However, for some reason, my linkedList instance returns "undefined" inside the loop. For instance:
Model.prototype.setData = function(data) {
this.data = data;
this.linkedList = new LinkedList();
this.startItem = $(data).find('slideShow').attr('startItem');
this.currentID = this.startItem || 1;
$(data).find('item').each(function() {
var imageVO = new ImageVO();
imageVO.id = $(this).find('id').text();
imageVO.image = $(this).find('image').text();
imageVO.title = $(this).find('title').text();
console.log(this.linkedList) //undefined
this.linkedList.addNode(imageVO);
});
this.linkedList.currentNode = this.linkedList.findNodeByIndex(this.currentID);
}