4 ms·
I didn't know about http://youmightnotneedjquery.com/ http://youmightnotneedjquery.com/ , but to me it seems very convincing that I need jQuery :)
by zaro 7y ago
I didn't know about http://youmightnotneedjquery.com/ http://youmightnotneedjquery.com/ , but to me it seems very convincing that I need jQuery :)
- invalidusernam3 7y agoExactly. I know I don't need jQuery, but sometimes it's nice to be able to do stuff like make an ajax request as a one liner vs 10+ lines. Peoples gripes with jQuery come from people importing the entire library to do one thing, like add a class to an element. Sure, in that case it's dumb to load the entire library for that single purpose. But if you're using it for 5 things? 10 things? It quickly becomes worthwhile.
- hatch_q 7y agohttps://caniuse.com/#search=fetch https://caniuse.com/#search=fetch For IE, you can use a polyfill if needed.
- jeltz 7y agoYeah, that site makes a really good case for using jQuery.
- ape4 7y agoSmall detail, what's with the plus in this code from that site: last = +new Date();
- leeoniya 7y agoconverts 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
- lewiscollard 7y agoIt 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
- ape4 7y ago+ can concatenate strings. So I guess there is an implied: 0 + in there to make it in integer mode.