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