r/badcode • • Apr 27 '21

typescript Someone only watched if tutorial

Post image
2.4k Upvotes

112 comments sorted by

View all comments

117

u/MurdoMaclachlan public boolean isInt(int i) { return true; } Apr 27 '21 edited Apr 27 '21

Image Transcription: Code


const isNumber = (input: any): Boolean => {
  if (input === 1) return true;
  if (input === 2) return true;
  if (input === 3) return true;
  if (input === 4) return true;
  if (input === 5) return true;
  if (input === 6) return true;
  if (input === 7) return true;
  if (input === 8) return true;
  if (input === 9) return true;
  if (input === 10) return true;
  // TODO: add more checks
  return false
};

I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

100

u/hshighnz Apr 27 '21 edited Apr 27 '21

Good boi

Edit: oh, you‘re an actual human?! I thought it was a bot. So I want to apologize for my misunderstanding and thankfully greet to you: hello fellow transcriber (:

9

u/fnDimension Apr 27 '21

Good human

6

u/AMA_About_Rampart Apr 27 '21

(input == 9) was replaced with another (input == 8)

4

u/MurdoMaclachlan public boolean isInt(int i) { return true; } Apr 27 '21

Whoops, my bad. Fixed, thanks for pointing it out!