Identifier has already been declared error using HTML-snippet

0
When I use an HTML-snippet to add some Javascript and I'm declaring a constant, I get this error. Is there a way to “start” over again, so I can use the same JS-file over and over again? I want to use this: const input = Array.from(document.querySelectorAll('input')); const textarea = Array.from(document.querySelectorAll('textarea')); const allInputs = input.concat(textarea); allInputs.forEach(etc.....) instead of this: Array.from(document.querySelectorAll('input')).concat(Array.from(document.querySelectorAll('textarea'))).forEach(etc.....) Thanks in advance!
asked
1 answers
0

Const cannot be changed or reassigned, so I think if you use let or var instead of const you should be fine.

answered