I spent more than an hour trying trying to debug why two functions were always returning undefined. I even put in conditional breakpoints and executed the statements to confirm the logic was correct.

I forgot return.

  • 1
    💔 omg. So much heartbreak for you. It happens to everyone (some silly mistake), but it still sucks every time
  • 1
    I know your struggle. I sometimes forget to assign the result of a method/function to a variable and wonder why it didn't work
  • 2
    You see, if you were using a good language... Jk, but most other languages throw an error if it's missing a return statement.
  • 1
    @CorruptComputer I was actually using typescript, but I didn't annotate the function. Otherwise it would have been a compiler error. Double face palm.
  • 2
    It's always "funny" to spend an hour or so writing some wonderful code and fire up the browser and and sit and wonder why the magic isn't happening.

    Then...oh yeah- I need to actually call that method.

Your Job Suck?
Get a Better Job
Add Comment