loading...

re: This and Bind In Javascript VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I run into this all the time when I wan to set up a callback. I could either do window.addEventListener('click', this.doSomething.bind(this)); ...
 

I imagine the speed is difference is hardly even noticeable to the human eye. I tried it and it felt almost the exact same speed.

 

You'll never be able to measure these types of micro-optimizations just by looking at them. But if you were to put this on a mousemove handler it would run hundreds of times a second. That is when using bind would matter.

Code of Conduct Report abuse