Golf Code stuck

Tell us what’s happening:
When I run my function, some answers return the expected phrase, but par, bogie and double bogie do not. I’ve tried rearranging my statements, but then the remaining opposite ones (hole in one, eagle and birdie) are false and the ones above are true. No matter how I craft it, par is always false.

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 names[1];
else if (strokes = par - 1) {
 return names[2];
else if (par = strokes) {
 return names[3];
else if (strokes = par + 1){
return names[4];
else if (strokes = par + 2) {
 return names[5];
else if (strokes >= par + 3) {
 return names[6];

 // Only change code above this line

golfScore(5, 4);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36.

Challenge: Golf Code

Link to the challenge:

Welcome, zeeathome.

Remember: This is the assignment operator: =
This is the equality operator: ==

Hope this helps

1 Like

It did!! I’ve been stuck there for 2 days! Thanks for correcting this rookie’s mistake!!