I was getting this error too -- problem is the line it fires on is completely bogus. Like the OP, it was an early line in my script that was being flagged:
var h_combinedView = true;
The error message is very misleading: "0x800a041c - JavaScript runtime error: Let/Const redeclaration"
The flagged line is not a const definition, and the value on it is defined once in my entire project and never again.
Eventually I tracked the problem down to an actual duplicated const definition.
const ve = { Normal: 'default', Search: 'search', View: 'view', Alts: 'ViewAlts', Edit: 'edit' }
(I had moved a definition used in multiple places into a shared file & forgot to remove one copy). The error message was legit -- it was a duplicated const definition -- but the line and identifier flagged had NOTHING to do with the problem.
Nothing like inaccurate error messages to force me to walk through my code.
:-)
var
alone will not do that, AFAIK. Something else is making the global property "const". Which browser/engine? – Ezekielezellvar editObj
on line 1 and puttingeditObj = null
in the jQuery onLoad function (first thing that gets executed anyway). Still not seeing why it was an error in the first place, though. Or is it just one of those IE things... – Soppyvar asdfasdfasdf = {};
Got the exact same error with debug on. Got the same error withasdfasdfasdf = null;
. – Icj