Advertisement
Liliana797979

Bonus score

Jan 22nd, 2021
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function bonusScore(input) {
  2.     let num = Number(input[0]);
  3.     let bonus = 0;
  4.  
  5.     if (num <= 100) {
  6.         bonus = 5;
  7.     } else if (num > 100) {
  8.         bonus = bonus * 0.8;
  9.     } else if (num >= 1000) {
  10.         bonus = bonus * 0.9;
  11.     }
  12.     if (num % 2 === 0) {
  13.         bonus = bonus + 1;
  14.     } else if (num % 10 === 5) {
  15.         bonus = bonus + 2;
  16.     }
  17.     console.log(bonus);
  18.     console.log(num + bonus);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement