Get me rid out of these .. help me

Get me rid out of these .. help me
0

#1

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 "Hole-in-one!";}

   else if(strokes <= par -2)
 {return "Eagle";}

 else if (strokes = "par -1")
 {return "Birdie";}

 else if (par)
 {return "Par";}

 else if (par + 1)
 {

return "Bogey";

 }

 else if (par + 2)
 {
   return "Double Bogey"
 }

else {"Go Home";}

  // Only change code above this line
}

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/golf-code/


#2

You check for the string in you code instead of numeric value:

if (strokes = "1")

and not using comparison (== or ===).


#3

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 “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 {“Go Home”;}

// Only change code above this line
}

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


#4

i do the following hint which i have suggested… now the code is not working…
plz help me …


#5

You have to use comparison operator and check (in your IF statements) for data type same as passed in function.