If you want a JavaScript like interval ID after creating a setInterval
timer, you can do the following,
function callbackFunc() {
console.log("I'm just an example callback function");
}
const timeoutObj = setInterval(callbackFunc, 1000);
const intervalId = timeoutObj[Symbol.toPrimitive](); //intervalId is an interger
// Later you can clear the timer by calling clearInterval with the intervalId like,
clearInterval(intervalId);
Note: This only works when your node version is >= v12.19.0
.