136

2 of my co-workers don't know that they shouldn't write any code after return statement of a function

Comments
  • 10
    co-"workers"...
  • 7
    May the force be with you
  • 2
    Don't they lint their code?
  • 2
    Uh-oh, spaghettios!
  • 13
    Maybe they think

    return false;

    Means it won't return, just carry on with the method? 😋
  • 1
    But you could use that ;)

    Just add a label and a goto ...

    ;D
  • 6
    Those people are called "users" not "co-workers" ... peers know how to write functions.
  • 1
    Are they Jr devs?
  • 0
    Sometimes I do that for debugging when I want a whole lot of a function skipped.

    Maybe they just forgot to undo it.
  • 1
  • 4
    Sometimes I like to mess with people
    function getVal() {
    return this.value;
    while(true) {
    console.log("ahahaha");
    }
    }
  • 1
    @calmyourtities yes kinda like that usually keep it from running some really long data logic... Though it didn't take forever, just close to it
  • 3
    Calm down people. Maybe his co-workers are in the sales or marketing team. He didn't specify that they were programmers.
  • 1
    Depends, but yes typically if it's in the main body of a function it's all useless. How did they even get a job?
  • 1
    I guess in JavaScript it is possible to write code after a Return Statement?
  • 3
    I accidentally once wrote "return" instead of "break".

    Oh how we laughed/panicked over why data files were only being partially processed.
  • 0
    @saintograph they don't know what lint is lol@vasq they are programmers
  • 0
    @akd5010 one has a degree
Add Comment