javascript - JSLint warns about ternary operator -
i have following code in javascript:
var = num ? 5 : "five";
code seems workable. jslint warns this:
#2 expected '?' @ column 9, not column 15. var = h ? 5 : "qwerty"; // line 10, pos 15 #3 expected ':' @ column 9, not column 19. var = h ? 5 : "qwerty"; // line 10, pos 19
so problem is? how disable such warnings?
its opinion that:
the ternary operator can visually confusing,
?
question mark ,:
colon begin line , increase indentation 4 spaces.var = h ? 5 : "qwerty";
to fix either comply rule or tick messy whitespace.
Comments
Post a Comment