Advertisement
Spocoman

06. Number in Range

Dec 19th, 2021 (edited)
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function numberInRange(input) {
  2.     let num = Number(input[0]);
  3.  
  4.     if (num >= -100 && num <= 100 && num !== 0) {
  5.         console.log("Yes");
  6.     }
  7.     else {
  8.         console.log("No");
  9.     }
  10. }
  11.  
  12.  
  13. Pешение с тернарен оператор:)
  14.  
  15. function numberInRange(input) {
  16.     let num = Number(input[0]);
  17.  
  18.     console.log(num >= -100 && num <= 100 && num !== 0 ? "Yes" : "No");
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement