What is wrong with my code


#1

this is not for codeacademy but its for my school assessment gcse 20%
i need to create a program that flips a coin, here is my code but i doesnt work can anybody help
var userChoice = prompt("would you like to flip a coin")

if 
{

userChoice = "yes"

var userChoice ===  Math.random();
}


     {    
else if
   
       (userChoice < 0.5)
return("the coin is heads")
            } 
    else
                    { 
   (userChoice>= 0.5 )
      return ("the coin is tails");
                  }

#2

okay so lets correct it step by step. The first correct to make is your if else blocks
remember this is the syntax if else block is written

if(condition){
    //do something
}
else if(some_other_condition){
    //do something else
}
else{
    //do another thing
}

use this to correct your logic and lets keep going