title: My if statment and else if statment is not getting executed, but there is not error
body: <p>So i'm writing a calculator and I'm struggling with the equal sign, I'm trying to do some simple bedmas (no brachets and no exponents), but my code keeps returning 0 as if the if statment ar egetting totally skipped</p>
  <p>I have no idea what is causing this as I'm getting no errors</p>
  <pre><code>function equal(){
          let exp = document.form.textview.value;
          let expArray = exp.split(/\b/);
          console.log(expArray);   //&lt;-if something doesn't work check this
          let total = 0;
          var lastOperator = &quot;+&quot;;
          var lastDig = 0;
          for(let i = 0 ; i &lt; expArray.length; i++){
            var dig = expArray[i].trim(); //value of &quot;i&quot;, the item currently in the loop
            if(isNaN(dig) == true){
               console.log(&quot;string&quot;)
             }
            else if(isNaN(dig) == false){
              console.log('not string');
                if (dig == &quot;/&quot;){ //this whole section gets skipped :(
                  var a = i + 1;
                  var p = i - 1;
                  var aDig = parseFloat(expArray[a].trim); //value after &quot;i&quot;
                  var bDig = parseFloat(expArray[p].trim); // value before  &quot;i&quot;
                  var sDig = aDig / bDig;
                  total = expArray.splice(bDig, 3, sDig);
                }
  
                else if ( dig == &quot;*&quot;){
                  var a = i + 1;
                  var p = i - 1;
                  var aDig = parseFloat(expArray[a].trim); //value after &quot;i&quot;
                  var bDig = parseFloat(expArray[p].trim) // value before  &quot;i&quot;
                  var sDig = aDig * bDig;
                  total = expArray.splice(bDig, 3, sDig);
                }
                else if ( dig == &quot;+&quot;){
                  var a = i + 1;
                  var p = i - 1;
                  var aDig = parseFloat(expArray[a].trim); //value after &quot;i&quot;
                  var bDig = parseFloat(expArray[p].trim)// value before  &quot;i&quot;
                  var sDig = aDig + bDig;
                  total = expArray.splice(bDig, 3, sDig);
                  console.log(expArray.splice(bDig, 3, sDig));
                }
                else if( dig == &quot;-&quot;){
                  var a = i + 1;
                  var p = i - 1;
                  var aDig = parseFloat(expArray[a].trim); //value after &quot;i&quot;
                  var bDig = parseFloat(expArray[p].trim) // value before  &quot;i&quot;
                  var sDig = aDig - bDig;
                  total = expArray.splice(bDig, 3, sDig);
              }
            }
  
              }
              document.form.textview.value = total;
  
          } ```
  </code></pre>