I am trying to do this:
var KEYS = {} ; KEYS.PHONE_TYPE = 'phone-type'; KEYS.AGENT_TYPE = 'agent-type'; var myAppConfig = { ... iconMap : { KEYS.PHONE_TYPE : 'icon-phone', KEYS.AGENT_TYPE : 'icon-headphones' }; ... };
But it does not work with the message: Expected ':' and instead saw '.'.
How can I initialize an object using indirect (non-literal) keywords?
To be clear, I want:
{ 'phone-type' : 'icon-phone', 'agent-type' : 'icon-headphones' }
source share