Last active
March 14, 2019 09:16
-
-
Save Qquanwei/f5842acff8de22021316c4a1858042b6 to your computer and use it in GitHub Desktop.
OverAssert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function submit(data) { | |
let errorMessage = ''; | |
if (!data.name) { | |
errorMessage = 'please input name'; | |
} else if (data.lastName && data.lastName.length > 10) { | |
errorMessage = 'length of lastName should less than 10 '; | |
} else if (data.age < 80) { | |
errorMessage = 'age should less than 80'; | |
} else if (data.experience > 3) { | |
errorMessage = 'experience should large than 3'; | |
} | |
... | |
... | |
if (errorMessage) { | |
//return and show | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment