Advertisement
PIBogdanov

js

Jan 29th, 2023
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function salary(input) {
  2.     let n = Number(input[0]);
  3.     let salary = Number(input[1]);
  4.  
  5.     for (let i = 0; i < n; i++) {
  6.         let tab = input[2];
  7.         if (tab == 'Facebook') {
  8.             salary -= 150;
  9.         } else if (tab == 'Instagram') {
  10.             salary -= 100;
  11.         } else if (tab == 'Reddit') {
  12.             salary -= 50;
  13.         }
  14.  if (salary <= 0) {
  15.             console.log('You have lost your salary.');
  16. return;
  17.         }
  18.         }
  19.             console.log(salary);
  20.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement