News for hackers. Stuff that matters.
Re:Why I'm still using jQuery by ape4 on Monday May 27, 2019 @08:46AM (#20021689)
Small detail, what's with the plus in this code from that site:

    last = +new Date();
Re:Why I'm still using jQuery by lewiscollard on Monday May 27, 2019 @08:55AM (#20021760)
It is a trick to coerce it to an integer.

    >> new Date()
    Date 2019-05-27T12:52:41.932Z
    >> +new Date()
    1558961556913
    >> +"4" // works on anything else :)
    4
Re:Why I'm still using jQuery by ape4 on Monday May 27, 2019 @10:12AM (#20022349)
+ can concatenate strings. So I guess there is an implied: 0 + in there to make it in integer mode.
Re:Why I'm still using jQuery by dentemple on Monday May 27, 2019 @01:33PM (#20023829)
There's no implication involved. It's the unary operator, and it performs the type conversion exactly as specced.
Re:Why I'm still using jQuery by ape4 on Monday May 27, 2019 @03:50PM (#20024812)
Re:Why I'm still using jQuery by leeoniya on Monday May 27, 2019 @08:54AM (#20021747)
converts the date object to a unix timestamp* (int). a + works for coercing stuff to numbers. e.g. +"0.5" is quicker than paraseFloat("0.5") and also saves you from having to know if you need to use parseFloat or parseInt. coersion to strings can also be done by appending to an empty string: "" + 0.5.

* in ms