index.js
//a local function to refresh the equationContainer with updated equation after button is pressed
a local function to refresh the equationContainer with updated equation after button is pressed
a local function to refresh the equationContainer with updated equation after button is pressed
function writeEquation() {
        let textResult = "";
        for (i = 0; i < n - 2; i++) {
          if (activeNumbers[i] == undefined) {
            textResult += " _ + ";
          } else {
            textResult += activeNumbers[i] + " + ";
          }
        }
        if (activeNumbers.length == n - 1) {
          equationContainer.innerHTML =
            textResult + " " + activeNumbers[n - 2] + " = " + finalSum;
          return;
        }
        equationContainer.innerHTML = textResult + " _ = " + finalSum;
      }
function writeEquation ( ) { let textResult = "" ; for ( i = 0 ; i < n - 2 ; i ++ ) { if ( activeNumbers [ i ] == undefined ) { textResult += " _ + " ; } else { textResult += activeNumbers [ i ] + " + " ; } } if ( activeNumbers . length == n - 1 ) { equationContainer . innerHTML = textResult + " " + activeNumbers [ n - 2 ] + " = " + finalSum ; return ; } equationContainer . innerHTML = textResult + " _ = " + finalSum ; }
a local function to refresh the equationContainer with updated equation after button is pressed
a local function to refresh the equationContainer with updated equation after button is pressed