Passing JavaScript test #13 in my JavaScript caluclator

I’m seeking assistance with passing JavaScript test #13 in my JavaScript Calculator project. You can view my work here: CodePen. Test can be run on codepen fo JavaScript Calculator.

13. If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign.

document.addEventListener("DOMContentLoaded", () => {
  let currentInput = "0";
  let previousInput = "";
  let operator = null;
  let justEvaluated = false;
  let expression = "";
  let lastInputWasOperator = false;

  const display = document.getElementById("display");
  const numbers = document.querySelectorAll(".number");
  const operators = document.querySelectorAll(".operator");
  const decimalButton = document.getElementById("decimal");

  const clearDisplay = () => {
    currentInput = "0";
    previousInput = "";
    justEvaluated = false;
    expression = "";
    lastInputWasOperator = false;
    updateDisplay();
  };

  const updateDisplay = () => {
    display.innerText = currentInput;
  };

  const handleNumberClick = (e) => {
    const value = e.target.innerText;

    if (justEvaluated) {
      currentInput = value;
      justEvaluated = false;
    } else {
      if (currentInput === "0" && value !== "0") {
        currentInput = value;
      } else if (currentInput !== "0") {
        currentInput += value;
      }
    }

    lastInputWasOperator = false;
    updateDisplay();
  };

  const handleDecimalClick = () => {
    if (!currentInput.includes(".")) {
      currentInput += ".";
      updateDisplay();
    }
  };

  const handleOperatorClick = (e) => {
    const value = e.target.innerText;

    if (justEvaluated) {
      previousInput = currentInput;
      justEvaluated = false;
      expression = "";
    }

    if (value === "-" && (currentInput === "0" || lastInputWasOperator)) {
      currentInput = currentInput === "-" ? "0" : "-";
      lastInputWasOperator = false;
      updateDisplay();
      return;
    }

    if (lastInputWasOperator) {
      if (value !== "-" && operator !== null) {
        operator = value;
        expression = expression.slice(0, -1) + operator;
      }
      return;
    } else {
      if (previousInput === "") {
        previousInput = currentInput;
      } else {
        handleEquals();
        previousInput = currentInput;
      }

      expression += currentInput + value;
      operator = value;
      currentInput = "0";
    }

    lastInputWasOperator = true;
    updateDisplay();
  };

  const handleEquals = () => {
    if (currentInput === "") return;

    expression += currentInput;

    try {
      expression = expression.replace(
        /([-+*/]){2,}/g,
        (match) => match[match.length - 1]
      );

      if (/^[*/]/.test(expression)) {
        expression = expression.substring(1);
      }

      currentInput = eval(expression).toString();

      currentInput = parseFloat(currentInput)
        .toFixed(4)
        .replace(/.?0+$/, "");

      expression = "";
      operator = null;
      previousInput = "";
      justEvaluated = true;
    } catch (e) {
      currentInput = "Error";
    }

    if (isNaN(currentInput)) {
      currentInput = "Error";
    }

    updateDisplay();
  };

  numbers.forEach((button) => {
    button.addEventListener("click", handleNumberClick);
  });

  operators.forEach((button) => {
    button.addEventListener("click", handleOperatorClick);
  });

  decimalButton.addEventListener("click", handleDecimalClick);

  document.getElementById("equals").addEventListener("click", handleEquals);
  document.getElementById("clear").addEventListener("click", clearDisplay);
});

I’ve tried several approaches to handle negative numbers, but I still have one test failing. Currently, I’m passing 15 out of 16 tests and would greatly appreciate any guidance or solutions you might have to help me get that last one passed!