I'm fairly new to Javascript, but trying to make an object. As far as I can tell document.gibado.Subway.Finals listed as undefined, but I don't understand why? Can someone explain this to me?
The error I'm getting says that
Cannot read property 'EMAIL' of undefined
This code doesn't work:
document.gibado.Subway = {
Finals: {
EMAIL: 'email',
STORE_NUMBER: 'storeNumber',
HIDE_OPTIONS: 'hideOptions'
},
hardQs: [{
text: 'To what email address should we send your unique code?',
answer: document.gibado.Subway.Finals.EMAIL
}]
};
This code does work:
document.gibado.Subway = {
Finals: {
EMAIL: 'email',
STORE_NUMBER: 'storeNumber',
HIDE_OPTIONS: 'hideOptions'
}
};
document.gibado.Subway.hardQs = [{
text: 'To what email address should we send your unique code?',
answer: document.gibado.Subway.Finals.EMAIL
}];