Ranter
Join devRant
Do all the things like
				++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
				Sign Up
			Pipeless API
 
				From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
				Learn More
			Comments
		
- 
				
				 C0D4644184ybetter then C0D4644184ybetter then
 
 bool valid = false;
 If(condition1 == true){
 if(condition2 == true){
 valid = true;
 }
 else{
 valid = false;
 }
 }
 else{
 valid = false;
 }
 
 My eyes bleed most days.
- 
				
				One day I found a line like that in our codebase… immediately checked git blame cause I wanted to know who the duck does that: it was me myself.
 
 Though in my defense, judging from the date, it must’ve been one of my first commits ever to any codebase. And then I was left to wonder how nobody mention it at PR..
- 
				
				@Shadowleaf seriously, you don’t see what’s wrong with that? Hint: it’s not the assignment…
- 
				
				 C0D4644184y@Shadowleaf the true/false implicitly returned is redundant. C0D4644184y@Shadowleaf the true/false implicitly returned is redundant.
 
 x = (condition1 && condition2)
 
 Is more then enough.
- 
				
				 bioDan55354y@iiii so tell me what does the following evaluate to? bioDan55354y@iiii so tell me what does the following evaluate to?
 
 const areYouSureImBool = (true && {})
 
 const areYouSureImBool2 = (true && '')
 
 const areYouSureImBool3 = (true && [])
- 
				
				 bioDan55354y@100110111 im not saying its not, im just saying there are cases where its valid to be that explicly in JS bioDan55354y@100110111 im not saying its not, im just saying there are cases where its valid to be that explicly in JS
- 
				
				 bioDan55354y@100110111 btw, its only speculation but i bet you can find shit in 85% of code bases bioDan55354y@100110111 btw, its only speculation but i bet you can find shit in 85% of code bases
- 
				
				Shadowleaf34y@100110111 For some reason was looking what's wrong with comparisons, not type. Guess i need to wake up before posting.
- 
				
				@bioDan I guess that’s a way to handle those cases, yes. Does lead to the question whether JS is ever a valid language choice, really. 😏
- 
				
				 bioDan55354y@iiii this post is about shitcode, its in the tags bioDan55354y@iiii this post is about shitcode, its in the tags
 
 i hope you now understand there are use cases where its valid, and that it depends on the type of the second condition.
 
 JS is a weak and dynamic type programming language, lamentably there are cases where this is a valid solution.
Related Rants










 When you "fix" a bug not by actually fixing the bug but by disabling the user's ability to cause the bug.
When you "fix" a bug not by actually fixing the bug but by disabling the user's ability to cause the bug.
 Welcome to my live.
Welcome to my live.
 Honest developer...
Honest developer...
someBoolean = (condition1 && condition2 ) ? true : false;
O.M.G....
rant
shitcode