Pops wrote:
  $("start").value -= 1*$("rows").value;    // <- WORKS AS EXPECTED
  $("start").value += 1*$("rows").value;      // <- BUG!!
  $("start").value -= -1*$("rows").value;   // <- FIX!!
To me,  that looks look like a JS type casting bug or inclusive
addition bug?

I don't think so.  I simply think of "+=" as shorthand, e.g.,

    a += b

is simple shorthand for

    a = a + b;

Because "a = a - b" cannot be a concatenation, the casting is done and a numeric value is returned. But "a = a + b" is legitimate for strings, so no casting is necessary, and a string is returned. That's the downside of using "+" for concatenation.

  -- Scott

Reply via email to