For a school project, I am trying to create a website that does things. For this I use HTML, JavaScript and CSS. I use a compiler that gives debugging hints. These tips are provided by JSLint . I was told that I should combine the two variables that I wrote, but I do not understand what this means.
I did some research (on Qaru and other websites), but they all come with people wanting to put variables into arrays.
Will someone kindly explain to me what should I do?
Code (simplified):
var x = document.getElementById("some id"); var y = document.getElementById("some other id"); var z = document.getElementsByTagName("some tag name");
And JSLint says:
"Combine this with the previous var statement: var y = document.getElementById (" some other identifier "); and
Combine this with the previous "var" statement. var z = document.getElementsByTagName ("some tag name");
Important note: the code works , but JSLint tells me about it.
javascript jslint
Ooooh4
source share