3 ms·
The closing curly brace of an anonymous function being on the same line as the last line of the body makes me cringe. something.forEach(function(event) {
by prophetjohn 14y ago
The closing curly brace of an anonymous function being on the same line as the last line of the body makes me cringe.
something.forEach(function(event) {
$.fn[event] = function(callback){ return this.bind(event, callback) }
Space between the closing parenthesis and opening curly of a named function, but not an anonymous function strikes me as 100% arbitrary. It's inconsistent and would bother me if I saw it in production code.
> No curly braces for single-line control flow statements such as if & friends
Disagree. It's too easy to add a line later and forget the curly braces. This goes back to the definition of pragmatic not fitting what's being advocated.