Spocoman

05. Number 100...200

Dec 10th, 2021 (edited)
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function nums100To200(input) {
  2.     let num = Number(input[0]);
  3.  
  4.     if (num < 100) {
  5.         console.log('Less than 100');
  6.     } else if (num > 200) {
  7.         console.log('Greater than 200');
  8.     } else {
  9.         console.log('Between 100 and 200');
  10.     }
  11. }
  12.  
  13. РЕШЕНИЕ С ТЕРНАРЕН ОПЕРАТОР:
  14.  
  15. function nums100To200(input) {
  16.     let num = Number(input[0]);
  17.    
  18.     console.log(num < 100 ? 'Less than 100' : num > 200 ? 'Greater than 200' : 'Between 100 and 200');
  19.  }
  20.  
Add Comment
Please, Sign In to add comment