DEV Community

Discussion on: Back to basics: Naming

Collapse
 
bgadrian profile image
Adrian B.G.

It returns a boolean answer, so the function should be a question, so it should start with "is" in this case.

I don't think there is a case where "isEmail" and "isEmailValid" are 2 different things, so I will choose the simplest one #KISS.
but ...if you have more features like

function isEmail(e){}
function isEmailRegistered(e){}
function isEmailAdmin(e){}

isEmail will create confusion, and it will have to refactored to isEmailValid.