SCRPT5039: Redeclaration of const property line 1 character 1
line1: var editObj = null;
This is the beginning of the file and I checked to make sure that variable is not in any other js files being called. Is it saying that I redeclare it later? (if so that line reference is not useful) or what is wrong with this?
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.
:-)
EDIT: Fixed it. For me, anyway. I got this error before the redeclaration error:
HTML1113: Document mode restart from Quirks to IE9 Standards
This suggests that IE finds what it thinks is an error, so loads the page again in Quirks mode. Loading the page twice makes it think everything is declared twice. So the solution is to find what IE didn't like.
First I ran the page through the online HTML validator. Next I ran my javascript through jsLint. After all that, IE9 seemed happy. And as a bonus I have better quality code. I hope.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With