r/badcode • sadistic • Apr 22 '21

js ternary operators at their maximum potential

Post image
960 Upvotes

73 comments sorted by

View all comments

44

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

Image Transcription: Code


const cmdJson = {
    type: cmd.type || 4,
    run: cmd.run ? cmd.run : cmd.fire ? cmd.fire : cmd.execute ? cmd.execute : cmd.callback ? cmd.callback : null
}

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!

26

u/blehmann1 depraved Apr 22 '21

good human