Tell us what’s happening:
This seems to work. But can you please let me know if this is efficient and scalable?
Your code so far
const names = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey", "Go Home!"];
function golfScore(par, stroke) {
if (stroke-par === 0 && stroke!=1){
return names[3]
} else if (stroke-par > 2){
return names.at(-1)
}
return names[stroke-1]
}
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36
Challenge Information:
Build a Golf Score Translator - Build a Golf Score Translator