4 ms·
Show HN: JavaScript Tips from ES5 to ES10
- Etheryte 8y agoThis reads more like a small collection of random code snippets than an actual book. I would expect a book to cover the reasons either why something works or why use one thing over another, but in this case it's mostly just here's a solution to this specific thing with no further explanation. A good example of what I mean is the number rounding subheading, which solely consists of a single sentence: > The use of ~~ operator for rounding numbers, in my opinion, it’s very weird, but it’s also an alternative than use Math.floor() function: [code sample]
- caioribeiro 8y agoThank you for your feedback, and you're right, this is a cookbook, but there is no small collection, and yes, a considerable list of js code snippets.
- bgdam 8y agoI only read a part of the sample, so my opinion is based on that. Personally, I'd not want anyone on my team to write code which utilizes many of these tips (ex: Using + to cast a date to a timestamp). These sort of tricks make reading, understanding and maintaining code a huge pain in the ass. I don't want to have to go Google what's happening every time I come across one of these tricks I'm not familiar with. I'd still read the book once for the chuckles at the weirdness of Javascript though, so kudos for the effort in compiling this book.
- caioribeiro 8y agoI agree with you, this old weird js stuff is a pain in the ass, but I added this weird stuff for developers learn not only the good parts, but bad too, because it's important to remenber how javascript was in the dark days and most important how this language evolved with the improvements provided by ES6/7/8/9/10.
- caioribeiro 8y agoAnd this weird stuffs is used a lot in many projects when you minify javascript.