I saw a javascript expression like this:
var foo = {...}[...];
can anyone explain what that means?
Best Regards
Update:
this is a code example:
var ENV_PRODUCTION = {
production: true,
development: false
}[process.ENV.NODE_ENV|| 'development'];
var a = {}[]) gives syntax error, so it's not valid.[1,2,3]), or just something that would evaluate to a property name? You've simplified the expression too much.var values = {key1: 'value1', key2: 'value2' }; var key = 'key1'; var foo = values[key];?x = { foo: 42, bar: 'baz' }['foo']is an immediately invoked object literal.