title: JS calculator bug
body: <p>P.S new to js,
  I made an ios like calculator in js in which the basic functioning is the user enters the first number which gets stored in a variable , screen gets cleared then the user enters the second number which again needs to be stored in a variable. I am currently having problem in storing the second number.</p>
  <hr />
  <pre><code>    const getnum = () =&gt; {
    let firstnum = parseFloat(ans.innerText);
    console.log(&quot;firstnum&quot; + &quot;=&quot; + firstnum);
  };
  </code></pre>
  <p>Copied this from internet to get the second number</p>
  <pre><code>operationperf = (operation) =&gt; {
    if (!numinmem) {
      numinmem = parseFloat(ans.textContent);
      operatorinmem = operation;
      ans.textContent = &quot;&quot;;
      return;
    }
    operatorinmem = operation;
    ans.textContent = getResultOfOperationAsStr();
    ans.textContent = &quot;&quot;;
  };
  </code></pre>
  <hr />
  <p>but this causes both the variables to have the same value so if i do 50+78 the calculator performs 50+50</p>
  <p>working demo: <a href="https://megahedron69.github.io/ios-Calculator/" rel="nofollow noreferrer">https://megahedron69.github.io/ios-Calculator/</a>
  javascript file: <a href="https://github.com/Megahedron69/ios-Calculator/blob/main/app.js" rel="nofollow noreferrer">https://github.com/Megahedron69/ios-Calculator/blob/main/app.js</a></p>