Advertisement
Guest User

Untitled

a guest
Aug 14th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. function Money() {
  2. let numbers = arguments[0];
  3. let n = Number(numbers[0]);
  4. let moneyPerPoint = Number(numbers[1]);
  5. let totalPoints = 0;
  6. for (var i = 2; i <= n+1; i++) {
  7. var currentPoint = Number(numbers[i]);
  8. if (i % 2 == 1) {
  9. totalPoints += currentPoint * 2;
  10. }
  11. else {
  12. totalPoints += currentPoint;
  13. }
  14. }
  15. let price = totalPoints * moneyPerPoint;
  16. console.log(`The project prize was ${price.toFixed(2)} lv.`);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement