title: How to get if/else statement to work inside function
body: <p>I'm trying to use an if/else statement inside a function to make it so that orders over 50 have free shipping (s = 0). </p>
  
  <p>I previously had shipping equal 15% of the cost of the order, which is now commented out. The function did work before I tried to add the if/else statement.</p>
  
  <p>There are no error codes showing.</p>
  
  <pre><code>function estcost() {
  
    var p = document.getElementById("price").value; //gets price for plant as entered in box by user
    var p = parseFloat(document.getElementById("price").value);
    var t = 0.086 * p; //calculates arizona sales tax
    //var s = 0.15*p;//calculates shipping cost based off of 15% of plant cost
    var s;
    if (p &lt; 50) {
      s = 0.15 * p; //shipping for orders under $50
    } else {
      s = 0; //shipping for orders $50 and over
    }
  
    return s;
    var c = t + s + Number(p); //calculates final cost
    var f = '$' + c.toFixed(2); //rounds cost to 2 decimal places
  
    document.getElementById("result").innerHTML = f; //allows me to call f in html
  }
  </code></pre>