Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function oscars(input) {
- let name = input[0];
- let points = parseFloat(input[1]);
- let juryNum = parseInt(input[2]);
- for (let i = 3; i < juryNum * 2 + 3; i += 2) {
- let juryName = input[i];
- let currentPoint = parseFloat(input[i + 1]);
- points += juryName.length * currentPoint / 2;
- if (points > 1250.5) {
- break;
- }
- }
- if (points > 1250.5) {
- console.log(`Congratulations, ${name} got a nominee for leading role with ${points.toFixed(1)}!`);
- } else {
- console.log(`Sorry, ${name} you need ${(1250.5 - points).toFixed(1)} more!`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement