ChrisB: script-optimierung mit JSLint

Beitrag lesen

Hi,

JSLint does not expect to see an assignment statement in the condition part of an if or for or while or do statement. This is because it is more likely that
if (a = b) {
was intended to be
if (a == b) {

If you really intend an assignment, wrap it in another set of parens:
if ((a = b)) {

Und das nur, um irgendeinen JavaScript-"Validator" zufriedenzustellen?

Also auf so einen Unfug wuerde ich glatt verzichten, und das Ding warnen lassen, wie es lustig ist.

MfG ChrisB

--
„This is the author's opinion, not necessarily that of Starbucks.“