Freecodecamp: Test cases are returning the correct value in the console, but it won't let me pass the challenge

Created on 11 Feb 2016  路  3Comments  路  Source: freeCodeCamp/freeCodeCamp

Challenge Golf Code has an issue.
User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

function golfScore(par, strokes) {
  // Only change code below this line
    if(strokes == 1){
    return "Hole-in-one";
  }
  else if(strokes <= par -2) {
     return "Eagle";
  }
  else if(strokes === par -1 ){
    return "Birdie";
  }
  else if(strokes === par) {
    return "Par";
  }
  else if(strokes === par + 1){
   return "Bogey";
  }        
  else if(strokes === par + 2){
    return "Double Bogey";
  }
  else if(strokes >= par + 3){
    return "Go Home!";
  }
  // Only change code above this line
}

// Change these values to test
golfScore(1, 1);

Most helpful comment

I found out the problem, the text in the return should match exaclty as mentioned by their text, for example, it should be Go Home!, not Go home

All 3 comments

return "Hole-in-one!";

-!-

I have the same issue.

I found out the problem, the text in the return should match exaclty as mentioned by their text, for example, it should be Go Home!, not Go home

Was this page helpful?
0 / 5 - 0 ratings