title: if else statement..calculation for the activity level
body: <pre><code>var bmr=100;
  var sum=50;
  var caloriesneeded = 0;
  
  var activitylevel = prompt("Enter your activity level ");
  document.write( "&lt;p&gt;You need to consume ");
  
  if ( activitylevel == "0"){
     document.write (caloriesneeded = bmr * 1.2 );
  
  }
  else if (activitylevel == "1-3"){
     document.write(caloriesneeded = bmr *  1.375 );
  
  }
  else if (activitylevel == "3-5"){
      document.write(caloriesneeded = bmr *  1.55 );
  
  }
  else if (activitylevel == "6-7"){
      document.write (caloriesneeded = bmr * 1.725 );
  
  }
  else if (activitylevel == "2x"){
      document.write(caloriesneeded = bmr * 1.9 );
  
  }
  
  else {
      document.write("invalid");
  }
  
  
  
  if (caloriesneeded &gt; sum){
      document.write ("&lt;p&gt;You still can consume " + (caloriesneeded - sum) + 
  "kcal of food&lt;/p&gt;");
  
  }
  
  else if (caloriesneeded == sum){
      document.write("&lt;p&gt;You have consumed just enough " + (caloriesneeded - 
  sum) + "kcal of food&lt;/p&gt;");
  
  }
  
  else if (caloriesneeded &lt; sum){
      document.write ("&lt;p&gt;You have over consumed  " + (sum - caloriesneeded ) 
  + "kcal of food&lt;/p&gt;");
  
  }
  </code></pre>
  
  <p>Only the first half of the code is working and the calculation for calories needed > sum, calories needed == sum and calories needed &lt; sum does not show any result. Only when the activity level is 'Invalid' then the second part of the code will be working. Anyone spot any errors? </p>