Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function salary(input) {
- let n = Number(input[0]);
- let salary = Number(input[1]);
- for (let i = 0; i < n; i++) {
- let tab = input[2];
- if (tab == 'Facebook') {
- salary -= 150;
- } else if (tab == 'Instagram') {
- salary -= 100;
- } else if (tab == 'Reddit') {
- salary -= 50;
- }
- if (salary <= 0) {
- console.log('You have lost your salary.');
- return;
- }
- }
- console.log(salary);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement