Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Will multiple callbacks on a single function affect performance or memory leak in node.js?

I have a function which returns several callbacks, each with a different value based on the given states thought the function, something like:

function dothis(callback) {
  for (var x = 1; x < 10; x++) {
    if (x % 2 == 0) {
      callback(x + " is even");
    }
  }
}

dothis(function(res) { 
  console.log(res);
})

That will print out the following:

2 is even 4 is even 6 is even 8 is even

I wonder if that would affect performance somehow or if it might end up in memory leak or any other issue with node.js

Comments