Skip to content

Commit

Permalink
updated bind section
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Nov 25, 2015
1 parent 04c33f4 commit def1441
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,16 @@ Check [test#1](https://jsperf.com/regexp-test-search-vs-indexof/12), [test#2](ht

## Avoid .bind, is slower.

Instead, save the context in a variable and them use it.
In general terms, `.bind` the context with a `Function` generate need a considerable effort.

```
var _this = this;
```
Native method is, in general JavaScript Engines slow. Instead, you can use:

- `.call` method (when you need to call the function once).
- `var self = this` is simple and effective.

Otherwise, exists a set of alternatives, such as libraries that try to implement a better way to do the same. In special, Lodash implementation is based in bitwise, that is very fast check in JavaScript.

*SOON MORE*
Check the [test](https://jsperf.com/bind-vs-jquery-proxy/104) bencharmk.

# License

Expand Down

0 comments on commit def1441

Please sign in to comment.