Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function bonusScore(input) {
- let digit = Number(input[0]);
- let bonusScore = 0.0;
- if (digit <= 100) {
- bonusScore += 5;
- } else if (digit > 1000) {
- bonusScore = digit * 0.1;
- } else {
- bonusScore = digit * 0.2;
- }
- if (digit % 2 == 0) {
- bonusScore += 1;
- } else if (digit % 10 == 5) {
- bonusScore += 2;
- }
- console.log(bonusScore);
- console.log(digit + bonusScore);
- }
- bonusScore(["2703"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement