Hi all,

I have recently come to use .bind a lot, because it makes for very
clean code.

So rather than doing

<code>
var x; // this has some value that comes from prior code
setTimeout(function() { console.log(x) }, 5000);
</code>

I am now often doing

<code>
var x;
setTimeout(console.log.bind(console, x), 5000);
</code>

The question I have is: what is more performant? Is there any reason
to avoid .bind()?

Regards, Phil

-- 
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

Reply via email to