12
W1ckeD
8y

When you see (condition === true) T_T :')

Comments
  • 8
    === is not == there may be a good reason for this.
  • 5
    I had a lead once that insisted the project style would include == true or == false for all conditionals. The ! operator was not allowed. At least we were allowed to use && and ||. Language was C#.
  • 1
    @Theo20185 Jezus Christ. Did you survive?
  • 0
    @W1ckeD Yes, I just let it roll off. The code was functionally unchanged. This was not something I was going to pick a fight over.
  • 1
    @Theo20185 So if code smell is a thing, was that lead smell?
  • 5
    Am I the only one who doesn't see an issue with this? Unless I'm missing something I'd always recommend using triple-equals where possible...
  • 0
    @luciam91 it's redundant in terms of syntax, in JS you could simply do `if (condition)`.
    But semantically there is an (IMO weak) argument for making the boolean comparison explicit.
  • 1
Add Comment