lmohanarun

Multiple if then

Dec 21st, 2015
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. IF you see
  2.  
  3. Add a final else clause to this conditional statement so that if the isAdmin variable and isStudent variables are both false an alert opens with the message "Who are you?"
  4.  
  5. The question is misleading ok.
  6.  
  7. There is no "final:" clause.
  8.  
  9. You would add multiple stacked if then conditionals.
  10.  
  11. var isAdmin = false;
  12. var isStudent = false;
  13.  
  14. if ( isAdmin ) {
  15. alert('Welcome administrator');
  16. } else if (isStudent) {
  17. alert('Welcome student');
  18. } else {
  19. alert('Who are you?');
  20. }
Add Comment
Please, Sign In to add comment