[Solved] My JavaScript program is not working [closed]


Replace if (isNaN(startMiles) = false) by if (isNaN(startMiles))

Remove } after else

<script type="text/javascript">
function calcMPG(){
   var startMiles = document.economy.startMilage.value;
   var endMiles = document.economy.endMilage.value;
   var gallons = document.economy.galonsUsed.value;

   if (isNaN(startMiles))   
   {
      window.alert("You can only enter numbers") 
   }      
   else 
   {
      document.mpg = document.write((endMiles - startMiles) / gallons) 
   }
}
</script>

1

solved My JavaScript program is not working [closed]