I always use the plusplus option, so I never noticed that when it is off there is no checking of the operand of ++. JSLint now complains if the operand is not...
... This thread implies the increment or decrement operator in the general sense, so I was clearly reading too much into the question. I would say this is...
... if (console === undefined) // could raise ReferenceError if console is not defined if (typeof console === 'undefined') // is safer, tests for the type of...
... You seem to have confused the result of the test for the operations imposed within the test decision. The typeof operator only tests for the type of the...
... No, typeof works on expressions (more precisely UnaryExpressions), including variables and object properties. That means it will also work on implicit...
right, but my point was: "if (console === undefined)" only works when console variable is defined. [Non-text portions of this message have been removed]...
There is a common pattern in Ajax libraries now to keep a single object that contains the library's stuff. Since the library may be distributed over several...
I have created a small launcher script for JavaScript Core (Safari's Nitro JavaScript Engine) It gives Mac users the ability to run JSLint from the command...
... No, because if the variable is defined then "if (console === undefined)" will not work, or rather it will evaluate to false. If console is defined then...
by "work" I meant "will evaluate the expression" not the result itself.again: if console is not defined, your test, if (console === undefined) will raise a...
... What about: var NAMESPACE; if (typeof NAMESPACE !== "object") { NAMESPACE = {}; } True, a falsy check is generally good enough; I'm talking about a...
I understand that the ?: operator is supposed to be used to select between multiple values, rather than multiple actions. I ran into an interesting situation:...
... I did not say the test was incorrect. I only said it was inefficient and likely did not accomplish what he expected. ... Unary operators are typically...
... I have discovered the root of this complication. If a variable is declared but not assigned or not used this text works perfectly fine. If the variable...
Well, val1 and val2 are the only possible values, you could do this: var next = {}; next[val1]=val2; next[val2]=val1; return this[prop] = next[this[prop]] ; If...
... That seems to be a good solution as well. However, that was not the question. I was indeed talking about the ?: operator, specifically about a JSLint error...
... Firefox. If the ECMA standard is in disagreement with me >then Firefox's interpretation of JavaScript is nonstandard or the standard is wrong. Wow ! Be...
... The thing that JSLint did not like was the use of an assignment as an expression. It will accept this[prop] = (this[prop] === val1) ? val2 : (this[prop]...
... I did a little tinkering, and here's what I came up with: return (this[prop] = ({ val1: val2, val2: val1 })[this[prop]]); What a fantastic construct....
Yeah, I did exactly that first too, but { val1 : val2 } is equivalent to { "val1" : val2 }. The braces notation only works if the sequence is expressed as...
... They why are unary operators frowned upon by the jslint tool? ... Operators require something to act upon. ... Functions are objects. Types are derived...