I am trying to make my setTimeout function reusable. But whenever I pass the remainingTime value, It does not decrement.
console.log(remainingTime); repeatedly returns 99 rather than decrementing ie 98, 97.
Any ideas?
let remainingTimeToSolveQuiz = 100;
const timeRemainingEl = document.querySelector("#time-remaining");
function quizCountDown(remainingTime, elementToDisplayTime) {
  remainingTime--;
  console.log(remainingTime);
  if (remainingTime === 0) {
    // something
    clearTimeout(timer);
  }
  elementToDisplayTime.textContent = remainingTime;
}
let quizTimer = setInterval(quizCountDown, 1000, remainingTimeToSolveQuiz, timeRemainingEl);<div>
Time: <span id="time-remaining"></span>
</div> 
     
    