title: Intl.NumberFormat Returning NAN values
body: <p>Why is this helper function returning a value for <code>subtotal</code> and <code>tax</code> but <code>NAN</code> for <code>fees</code> and <code>ordertotal</code>?</p>
  <p>OrderSummary.jsx</p>
  <pre><code>const taxRate = 0.0925;
  
  const OrderSummary = ({ addCSS, classes, merchantId, merchantName, step, setStep }) =&gt; {
    const context = useContext(ProductContext);
    let items = Array.isArray(context.cart) ? context.cart : [];
    if (step === 4) {
      items = Array.isArray(context.order) ? context.order : [];
    }
    const subtotal = items.reduce((acc, cur) =&gt; {
      return acc + cur.total * (cur.company_id === merchantId) * 1;
    }, 0);
    let tax = subtotal * taxRate;
    tax = parseFloat(tax.toFixed(2));
    let fee = subtotal * ApplicationFee * 0.01;
    fee = parseFloat(fee.toFixed(2));
    const total = subtotal + tax + fee;
      &lt;LineItem&gt;
        &lt;S2&gt;Subtotal&lt;/S2&gt;
        &lt;S2&gt;{formatCurrency(subtotal)}&lt;/S2&gt;
      &lt;/LineItem&gt;
      &lt;LineItem&gt;
        &lt;S2&gt;Tax&lt;/S2&gt;
        &lt;S2&gt;{formatCurrency(tax)}&lt;/S2&gt;
      &lt;/LineItem&gt;
      &lt;LineItem&gt;
        &lt;S2&gt;Fee&lt;/S2&gt;
        &lt;S2&gt;{formatCurrency(fee)}&lt;/S2&gt;
      &lt;/LineItem&gt;
  
      &lt;Total&gt;
        &lt;H5&gt;Order Total&lt;/H5&gt;
        &lt;H5&gt;{formatCurrency(total)}&lt;/H5&gt;
      &lt;/Total&gt;
  </code></pre>
  <p>helperFunctions.jsx</p>
  <pre><code>    export const formatCurrency = (num) =&gt; {  
        if (typeof num !== 'number') return num
        return new Intl.NumberFormat('en-US', {style: 'currency', currency: 'USD'}).format(num)
      }
  
  addTotals = () =&gt; {
  let subTotal = 0;
  this.state.cart.map((item) =&gt; (subTotal += item.total));
  const tempFees = subTotal * ApplicationFee * 0.01;
  const fees = parseFloat(tempFees.toFixed(2));
  const total = subTotal + fees;
  this.setState(() =&gt; {
    return {
      cartSubTotal: subTotal,
      cartFees: fees,
      cartTotal: total,
    };
  });
  </code></pre>
  <p>};</p>
  <p><a href="https://i.stack.imgur.com/oEUDR.png" rel="nofollow noreferrer">Image shows a Subtotal and Tax being calculated but NAN for Fee and Order Total</a></p>