2 ms·
There's a part of me that likes this style because it's compact, but I've learned to avoid relying on others understanding shorthand. The rule of thumb I go by
by nperez 11y ago
There's a part of me that likes this style because it's compact, but I've learned to avoid relying on others understanding shorthand. The rule of thumb I go by right now is that if I can make my code read more like English, that is the style I will prefer.
To a junior developer, "if (typeof request.session !== 'undefined') {var sessionId = request.session.id;}" is going to be more readable. It's hard to mistake the intention.
Most people in this industry speak English. It's easier to take advantage of that than to rely on your peers understanding &&||@(#*$((())) or whatever.
..unless you're taking part in an obfuscated code contest, in which case you should use these techniques as a basic building block.