I just stumbled upon a strange JavaScript error using Mozilla Rhino as a JavaScript engine.
This one line script throws an error:
eval("const a = 5;");
The error is:
TypeError: redeclaration of var a.
I would expect this error, if the line is execute multiple times - but it is only executed once, as this one line is the whole program.
Can anyone explain, why this error occurs?