4 ms·
Which also states this, directly under that "bad" example: Note: If you're often writing code like this, you may be trying to be too clever. Clever short-hand
by ezekg 8y ago
Which also states this, directly under that "bad" example:
Note: If you're often writing code like this, you may be trying to be too clever.
Clever short-hands are discouraged, in favor of clear and readable expressions, whenever possible.
Instead of this:
;[1, 2, 3].forEach(bar)
This is strongly preferred:
var nums = [1, 2, 3]
nums.forEach(bar)
- Retra 8y agoThe irony is that building a language which avoids semicolons by automatically inserting them is arguably taking a clever short-hand in favor of unclear and ambiguous expressions.