Q: Browser: Identifier input has already been declared, but only on wordpress? I am making a search form that expands, I am doing exactly this ... 
https://codepen.io/MilanMilosev/pen/JdgRpB
I made a simple html and it works, but I want to put it in a wordpress, with an online store, but when I put all the code, the console marks the error
Uncaught SyntaxError: Identifier 'input' has already been declared
And this is the javascript used
const input = document.getElementById ("search-input");
const searchBtn = document.getElementById ("search-btn");

const expand = () => {
   searchBtn.classList.toggle ("close");
   input.classList.toggle ("square");
};

searchBtn.addEventListener ("click", expand);

Anyone have an idea why it happened?

A: This error is due to the usage of a constant and its being redeclared in the line:
const input = document.getElementById ("search-input");

Another instance of const input already exists per the error:

Uncaught SyntaxError: Identifier 'input' has already been declared

You simply need to rename the variable as you can not redeclare the constant in the same scope. let will allow for redefining ( changing the value ), but you should never need to redeclare a variable.
