4 ms·
1. Don't use with. It's hard to reason about, and it breaks many compiler optimizations (you're adding a dynamic object into the scope chain). 2. Just don't ev
by ax 15y ago
1. Don't use with. It's hard to reason about, and it breaks many compiler optimizations (you're adding a dynamic object into the scope chain).
2. Just don't ever use == or !=. Forget they exist. Done.
- digitallimit0 15y agoAre there any other hard and fast rules I should be aware of?
- funkah 15y agoAre there ever. Read "JavaScript: The Good Parts" or watch the lectures by the same name on YouTube.
- TeMPOraL 15y agoI recently added my own syntax rule to JavaScript mode in Emacs to highlight lone { at the beginning of line (with or without trailing whitespaces). After your comment, I think about adding some more highlights for with, == and !=.
- PotatoEngineer 15y agoI've always found == to be very useful when comparing undefined, because undefined == null. It's very rare that I want to treat undefined and null separately (unless one or the other means there was an error earlier).
- funksta 15y agoThat's the only reasonable use for ==, IMO.