The other 2 devs on my team (both senior to me) routinely check in code like this:
function(filename) {
if (!filename) {
this.setState( {x : null});
}
var s = filename;
if (s) {
this.setState({y :''});
}
else {
this.setState({z: false});
}
}
Which to me is unfinished code (I truncated variable names). I always try to cleanup my code before checking in, probably to my detriment. They both are much faster at pushing features out. But god, some of the code is just unreadable. Also--no comments. For some reason everyone at my current company refuses to use comments.
And I've seen plenty of:
x == true ? true : false
ternaries, though in javascript, these are not necessarily redundant and are easy to mistake. A couple other favorites I've seen:
if (x == 'true') ...
and
var data = {option: 1}
var context = this;
this.someMethod.bind(this, context, data, data.option)
And I've seen plenty of:
ternaries, though in javascript, these are not necessarily redundant and are easy to mistake. A couple other favorites I've seen: and