daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function submit(data) {
  2.  
  3.   let errorMessage = '';
  4.  
  5.   if (!data.name) {
  6.     errorMessage = 'please input name';
  7.   } else if (data.lastName && data.lastName.length > 10) {
  8.     errorMessage = 'length of lastName should less than 10 ';
  9.   } else if (data.age < 80) {
  10.     errorMessage = 'age should less than 80';
  11.   } else if (data.experience > 3) {
  12.     errorMessage = 'experience should large than 3';
  13.   }
  14.   ...
  15.   ...
  16.  
  17.   if (errorMessage) {
  18.      //return and show
  19.   }
  20.   ...
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top