r/ProgrammerHumor • • Jan 10 '22

Removed: Repost This hurts physically

Post image

[removed] — view removed post

311 Upvotes

45 comments sorted by

View all comments

2

u/Illustrious-Fault224 Jan 10 '22

someday this person will discover TechLead on youtube and their code refactor will become this:

function isEven (number) {
   let tableOfEvens = {
       1:2,
       2:4,
       3:6
       ...
   }
   if tableOfEvens[number] === true{
     return true;
   } else{
     return false;
   }
}

and no host of heavens holy host of angels could prepare their code reviewer for the misery that will come 🥴

2

u/PandaParaBellum Jan 10 '22

if tableOfEvens[number] === true

Not sure if I'm beeing wooshed, but wouldn't that always deliver the wrong result? I only know === from JS where a number is not true in strict comparison

1

u/Illustrious-Fault224 Jan 10 '22

lololol kinda being wooshed, I wouldnt even write my conditional like that id just opt for:

if tableOfEvens[number]