Build a Golf Score Translator - Build a Golf Score Translator

Tell us what’s happening:

None of my tests are passing except for the first two and i feel like it is a really small problem i am currently not finding. All of my testing with the console.log are coming up correctly with the correct score return but i am confused on why it isn’t registering it.

Your code so far

const score = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey", "Go Home!"]

function golfScore (par, strokes) {
 if (strokes === 1 ) {
   return console.log(score[0])
 }
 else if ( strokes <= par - 2) {
   return console.log(score[1])
 }
 else if ( strokes === par - 1) {
   return console.log(score[2])
 }  else if (strokes === par) {
   return console.log(score[3])
 }  else if (strokes === par + 1) {
   return console.log(score[4])
 }  else if ( strokes === par + 2) {
   return console.log(score[5])
 }  else if ( strokes >= par + 3) {
   return console.log(score[6])
 } else {
   return console.log("Score:")
 }
}


console.log(golfScore(3,1))
console.log(golfScore(5,2))
console.log(golfScore(5,4))
console.log(golfScore(5,5))
console.log(golfScore(5,6))
console.log(golfScore(5,7))
console.log(golfScore(5,9))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0

Challenge Information:

Build a Golf Score Translator - Build a Golf Score Translator

const names = [“Hole-in-one!”, “Eagle”, “Birdie”, “Par”, “Bogey”, “Double Bogey”, “Go Home!”];
You have replaced this starting code, which is causing the tests to fail.

console.log() is not a valid return statement.

1 Like

Thank you this helped a lot, have a great day.