Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function movieStars(input) {
- let budget = Number(input[0]);
- let index = 1;
- let command;
- while ((command = input[index++]) !== "ACTION" && budget >= 0) {
- if (command.length > 15) {
- budget *= 0.8;
- } else {
- budget -= Number(input[index++]);
- }
- }
- if (budget >= 0) {
- console.log(`We are left with ${budget.toFixed(2)} leva.`);
- } else {
- console.log(`We need ${Math.abs(budget).toFixed(2)} leva for our actors.`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement