Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function traveling (input){
- let destination = "";
- money = 0;//1 място
- while (true){
- destination = input.shift();
- if (destination == "End"){
- break;
- }
- let neededMoney = Number(input.shift());//2, 3 място
- let savedMoney = 0;//4 място
- while (savedMoney < neededMoney){
- money = Number(input.shift())//5 място
- savedMoney += money;
- }
- console.log(`Going to ${destination}!`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement