It's best practice to use document.getElementById over the global variable because defining a local variable colorScheme would take precedence. It's also annoying to debug these global variables because they are not explicitly defined. When searching for something like colorScheme = you won't find anything, and finding something like colorScheme.addEventListener tells you nothing about the type of variable. However, finding document.getElementById tells you it's a DOM element.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It's best practice to use
document.getElementByIdover the global variable because defining a local variablecolorSchemewould take precedence. It's also annoying to debug these global variables because they are not explicitly defined. When searching for something likecolorScheme =you won't find anything, and finding something likecolorScheme.addEventListenertells you nothing about the type of variable. However, findingdocument.getElementByIdtells you it's a DOM element.