I am collaborating on a dynamically generated web page that uses mustache and js to determine what to display. I want to have a function that returns one object given a certain global condition and a different object if that condition is not the case, but I can't seem to get it to work.
getNameTokens: function() {
var tokens;
if(world.indexOf('9') == 1 ||world.indexOf('9') == 0) {
tokens = {agent: 'president', ent: 'company', ownsf: 'the company\'s', owns: 'its'};
} else {
tokens = {agent: 'player', ent: 'player', ownsf: 'his', owns: 'his'};
}
return tokens;
},
'tokenNames': getNameTokens(),
Am I doing somthing wrong here?
getNameTokens is not definedor something?