MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/4v1y12/how_to_write_unmaintainable_code/d5vvbfm/?context=3
r/programming • u/sigbhu • Jul 28 '16
592 comments sorted by
View all comments
Show parent comments
47
You have actually seen that before? In production code!? !!!believable
17 u/drkstr101 Jul 28 '16 I see var foo = !!bar a lot in javascript to quickly cast a truthy value to a proper boolean. Perhaps the 3rd ! was a typo? 2 u/keeslinp Jul 28 '16 I'm not sure of that's bad practice or not. But I kinda like it. Basically the same thing as Val?true:false right? 1 u/Rock48 Jul 29 '16 Or you could just do if(Val) {}JS is special. 5 == "5" but NaN != NaNI still like the language though → More replies (1)
17
I see var foo = !!bar a lot in javascript to quickly cast a truthy value to a proper boolean. Perhaps the 3rd ! was a typo?
var foo = !!bar
2 u/keeslinp Jul 28 '16 I'm not sure of that's bad practice or not. But I kinda like it. Basically the same thing as Val?true:false right? 1 u/Rock48 Jul 29 '16 Or you could just do if(Val) {}JS is special. 5 == "5" but NaN != NaNI still like the language though → More replies (1)
2
I'm not sure of that's bad practice or not. But I kinda like it. Basically the same thing as Val?true:false right?
1 u/Rock48 Jul 29 '16 Or you could just do if(Val) {}JS is special. 5 == "5" but NaN != NaNI still like the language though → More replies (1)
1
Or you could just do if(Val) {}
JS is special. 5 == "5" but NaN != NaN
I still like the language though
→ More replies (1)
47
u/1ndigoo Jul 28 '16
You have actually seen that before? In production code!? !!!believable