Advertisement
TheTintin

Untitled

May 23rd, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Au lieu de ça
  2. function save() {
  3.         if(prenom === "") {
  4.                 alert("Prénom manquant !");
  5.         } else {
  6.                 if(nom === "") {
  7.                         alert("Nom manquant !");
  8.                 } else {
  9.                         traitement();
  10.                 }
  11.         }
  12. }
  13.  
  14. // On fait parfois ça
  15. function save() {
  16.         if(prenom === "") {
  17.                 alert("Prénom manquant !");
  18.                 return;
  19.         }
  20.        
  21.         if(nom === "") {
  22.                 alert("Nom manquant !");
  23.                 return;
  24.         }
  25.        
  26.         traitement();
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement