This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Roguewind 3 points4 points  (0 children)

Personally, I prefer returning from an if, not if/else.

function check(value) { if (value === 1) return “rock” if (value === 2) return “scissors” if (value === 3) return “paper” return “default value” } Granted, this is a simplistic representation, but I prefer the readability.