Spocoman

04. Password Guess

Dec 10th, 2021 (edited)
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function password(input) {
  2.  
  3.     if (input[0] === 's3cr3t!P@ssw0rd') {
  4.         console.log('Welcome');
  5.     } else {
  6.         console.log('Wrong password!');
  7.     }
  8. }
  9.  
  10. Решение с тернарен оператор:
  11.  
  12. function password(input) {
  13.  
  14.       console.log(input[0] === 's3cr3t!P@ssw0rd' ? 'Welcome' : 'Wrong password!');
  15. }
Add Comment
Please, Sign In to add comment