execjs
execjs copied to clipboard
ExecJS::ProgramError: Unexpected token: name (key)
The following code is raising this error: ExecJS::ProgramError: Unexpected token: name (key)
var key = 'dummy',
plugin = {};
plugin.variables = {
[key + '1']: "1",
[key + 'Ctrl-2']: "2",
};
However this code does not:
var key = 'dummy',
plugin = { variables: {} };
plugin.variables[key + '1'] = "1";
plugin.variables[key + 'Ctrl-2'] = "2",
I understand that the former is ES6 compatible and the latter is ES5 compatible. Is this the reason I am getting the error?