tests:
- text: '<code>golfScore(4, 1)</code>应该返回“Hole-in-one!”'
testString: assert(golfScore(4, 1) === "Hole-in-one!");
- text: '<code>golfScore(4, 2)</code>应该返回“Eagle”'
testString: assert(golfScore(4, 2) === "Eagle");
- text: '<code>golfScore(5, 2)</code>应该返回“Eagle”'
testString: assert(golfScore(5, 2) === "Eagle");
- text: '<code>golfScore(4, 3)</code>应该返回“Birdie”'
testString: assert(golfScore(4, 3) === "Birdie");
- text: '<code>golfScore(4, 4)</code>应该返回“Par”'
testString: assert(golfScore(4, 4) === "Par");
- text: '<code>golfScore(1, 1)</code>应该返回“Hole-in-one!”'
testString: assert(golfScore(1, 1) === "Hole-in-one!");
- text: '<code>golfScore(5, 5)</code>应该返回“Par”'
testString: assert(golfScore(5, 5) === "Par");
- text: '<code>golfScore(4, 5)</code>应该返回“Bogey”'
testString: assert(golfScore(4, 5) === "Bogey");
- text: '<code>golfScore(4, 6)</code>应该返回“Double Bogey”'
testString: assert(golfScore(4, 6) === "Double Bogey");
- text: '<code>golfScore(4, 7)</code>应该返回“Go Home!”'
testString: assert(golfScore(4, 7) === "Go Home!");
- text: '<code>golfScore(5, 9)</code>应该返回“Go Home!”'
testString: assert(golfScore(5, 9) === "Go Home!");
var names = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey", "Go Home!"];
function golfScore(par, strokes) {
// Only change code below this line
return "Change Me";
// Only change code above this line
}
// Change these values to test
golfScore(5, 4);