I'm trying to decide that JSL is warning about two things, I do not know how Have to decide. Which line should change the code? I have pasted the code in question and warned about them very early thanks for your suggestions / answers.
Jayslin says:
At issue 137: A conditional expression was expected and instead an assignment was seen.
while (elem = document.getElementById ("optionsDiv" + g))
at issue 140: expected '{ 'And' Return 'was seen instead.
Return g;
function isAnyOptionVisible () {Var g = 0; While (elem = document.getElementById ("optionsDiv" + g)) {if (elem.className === "optionsDivVisible") returns g; G ++; } Return -1; There is nothing wrong with the condition, except that elem
can be a global if it has not been declared in the external area, if it has not been announced, then do this before hand: var elem, g = 0; If you want to please JSLint, you can add blank jars to clarify:
while ((elem = document.getElementById ("OptionsDiv" + G))! == faucet) I do not see anything about "expected {"}, however, by putting G ++ on the same line, weird brace Is the style. Remember that JSLIT is partly about Crockford's personal preferences, which you do not always have to agree to. Edit: OK, second error is because JSLIND wants that you put the leak in the braces, like:
if (elem.className === "OptionsDivVisible") {return g; } G ++; This is also the style that I like in code. I think it avoids some errors. However, it is subjective again, the clear business fact is that it adds two rows.
Comments
Post a Comment