Advertisement
Marin171

salary

Aug 31st, 2022
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. function solve(input) {
  2. let n = Number(input[0]);
  3. let salary = Number(input[1]);
  4. let sites = 0;
  5.  
  6. for(let i = 1; i <= n + 1; i++) {
  7.  
  8. switch(sites) {
  9. case "Facebook":
  10. salary -= 150;
  11. break;
  12.  
  13. case "Instagram":
  14. salary -= 100;
  15. break;
  16.  
  17. case "Rebbit":
  18. salary -= 50;
  19. break;
  20. }
  21.  
  22. if(salary <= 0) {
  23. console.log("You have lost your salary.");
  24. return;
  25. } else {
  26. console.log(salary);
  27. return;
  28. }
  29. }
  30. }
Tags: js
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement