I created a function to generate and return an object:
function TickersObj(tag, array, boolLots, boolOptions, boolDisplay) {
tag = tag || {};
array = array || [];
boolLots = boolLots || false;
boolOptions = boolOptions || false;
boolDisplay = boolDisplay || true;
console.log('tag = ', tag);
console.log('array = ', array);
console.log('boolLots = ', boolLots);
console.log('boolOptions = ', boolOptions);
console.log('boolDisplay = ', boolDisplay);
this.assoTikArray = array;
this.lotsOfTags = boolLots;
this.tagOptions = boolOptions;
this.tagsHoverDisplay = boolDisplay;
return this;
}
Later down in my code I pass in the values like so:
switch(type) {
case 'tagsPanel':
tag.tickers = data.data.ticker_tag.tickers;
var tickersObj = TickersObj(tag, tag.tickers, tag.lotsOfTags, true, true);
return tickersObj;
break;
....
However once it gets to this line this.assoTikArray = array;
I get the error Cannot set property assoTikArray of undefined
Thoughts on what I'm doing wrong?