Advertisement
fbinnzhivko

Untitled

Sep 22nd, 2016
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Created by 123 on 20.9.2016 г..
  3.  */
  4. function number(input) {
  5.     let num = Math.abs(Number(input[0])); //вземам абсолутна стоиност за премахна минуса на числото
  6.  
  7.     if (num % 2 == 0) {
  8.         console.log('even')
  9.     }
  10.     else if (num % 2 == 1){
  11.         console.log('odd')
  12.     }
  13.     else{
  14.         console.log('invalid')
  15.     }
  16.  
  17. }
  18. number('5');
  19. number('8');
  20. number('1.5');
  21. number(-3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement