Golf Code problem somebody help

Tell us what’s happening:

Your code so far

var names = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey", "Go Home!"];
function golfScore(par, strokes) {
  // Only change code below this line

  if (strokes = 1){
    return names[0];
  else if(strokes <= par -2){
    return name[1];

  else if (par -1 ){
    return name[2]
  else if (par){
    return par;

  return "Change Me";
  // Only change code above this line

// Change these values to test
golfScore(5, 4);

Your browser information:

Think about how you are assigning the strokes. Look up comparison operators.

the first two ‘if’ statements you started them correct but the next ones you changed how you were doing it.

When you return the name, take a look at what that name should be. Like par - 1 is “Birdie”. It shows you this to the left of where your coding.

Hope that helps a bit. First time i’ve tried to help contribute to the forum :slight_smile:

This is an assignment operator, you should be using the equality comparison ===

The array is called names not name

This is not a comparison, just a number - you need something that gives true or false

You need to use names

This is again a number, not a true or false check

You need to return one of the strings from thenames array

There are seven conditions so you need 7 return statements, one for each of these - or 8 if you leave there the return "Change me" thing