javascript - Is it considered better to write if return else return or if return followed by implicit else return? -


which of following considered better or more standard?

if followed implicit else

if (something === true) {     return } return null 

if followed explicit else

if (something === true) {     return } else {     return null } 

the background why asking find explicit else option easier read , better, while have colleagues prefer implicit else because more succinct.

just choose guideline , follow it. airbnb javascript guideline quiet popular https://github.com/airbnb/javascript.

i prefer

if (something === true) {     return } return null 

there no need wrap inside else statement if there no code following it


Comments

Popular posts from this blog

java - How to compare two classes -

javascript - Why Selenium can't find an element that is graphically visible -

c# - Get the Class name in a class with atribute inside a attribute method -