Hi!
Have been reading up on process.nextTick and found this one rather odd.
It's forcing the calling function to run again.
function addasync(no1, no2, result)
{
res = no1 + no2;
this.result = result(false, res);
process.nextTick(function() {
this.result = result(true, res);
});
};
addasync(1, 2, function(err, res) {
console.log(res);
});
function addsync(no1, no2) {
return (no1 + no2);
}
console.log(addsync(4, 2));
When I run this code I get the following output.
3
6
3.
Any ideas why this could be happening.
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en