79216904

Date: 2024-11-23 00:27:02
Score: 0.5
Natty:
Report link

Like this:

const var1 = 'dynFuncName';
const obj = { [var1]() { throw 'error' } };
// or const obj = { [var1]: function() { throw 'error' } };
// or const obj = { [var1]: () => { throw 'error' } };

const fn = obj[var1];
fn();

Results in the following console error message:

VM83:5 Uncaught error
dynFuncName @   VM83:5
(anonymous) @   VM83:9
(anonymous) @   VM83:10

As per:

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
Posted by: Gima