Sunday, 16 April 2017

Which is the better way of calling function in timeout?

consider this code,

var hi = 'Hello';

1.First approach

setTimeout(function(){
doSomething(hi);
},0);

2.Second approach

setTimeout(doSomething.bind(null,hi),0);



via Pratik Bhurewar

No comments:

Post a Comment