var interval = setInterval(function (){
console.log("Hello world");
}, 1000);
var thing = interval;
console.log(thing);
clearInterval(interval);
console.log("interval cleared");
console.log(thing);
thing
is printed differently before and after clearing interval
and I can't understand why. Halp pls?
Edit: Sorry, I should've been clearer. I'm using node.js, and this is the output to the above code:
{ _idleTimeout: 1000,
_idlePrev:
{ _idleNext: [Circular],
_idlePrev: [Circular],
msecs: 1000,
ontimeout: [Function: listOnTimeout] },
_idleNext:
{ _idleNext: [Circular],
_idlePrev: [Circular],
msecs: 1000,
ontimeout: [Function: listOnTimeout] },
_idleStart: 1394616963526,
_onTimeout: [Function: wrapper],
_repeat: true }
interval cleared
{ _idleTimeout: -1,
_idlePrev: null,
_idleNext: null,
_idleStart: 1394616963526,
_onTimeout: null,
_repeat: false,
ontimeout: null }
Why is thing
affected by the clearInterval at all?