Advertisement
Guest User

зад5

a guest
Jul 23rd, 2020
2,800
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. function best_player(input){
  2. let i=0;
  3. let max=0;
  4. let best;
  5. while(input[i]!="END"){
  6. let name=input[i];
  7. let br=Number(input[i+1]);
  8. if(br>max) {max=br;
  9. best=name;}
  10. if(max>=10) break;
  11. i+=2;
  12. }
  13. console.log(`${best} is the best player!`);
  14. if(max>=3) console.log(`He has scored ${max} goals and made a hat-trick !!!`);
  15. else console.log(`He has scored ${max} goals.`);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement