Skip to content

Commit

Permalink
Fixed wording in /function.
Browse files Browse the repository at this point in the history
  • Loading branch information
kerwitz committed Jun 14, 2017
1 parent bb8571b commit 2a2b42d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docs/function/bind.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

In general terms, `.bind` the context with a `Function` generate need a considerable effort.

Native method is, in general JavaScript Engines slow. Instead, you can use:
The native method is slow in general JavaScript Engines. 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](https://lodash.com) implementation is based in bitwise, that is very fast check in JavaScript. Check the [test](https://jsperf.com/bind-vs-jquery-proxy/104) benchmark.
!> Otherwise, a set of alternatives exists, such as libraries that try to implement a better way to do the same. Specially [Lodash](https://lodash.com) implementation is based in bitwise, which is really fast. Check the [test](https://jsperf.com/bind-vs-jquery-proxy/104) benchmark.

If you are using `.bind` oriented to memoize arguments values that doesn't change around the `Function` calls, like:

Expand All @@ -23,7 +23,7 @@ sayMonday('Kiko')
// => 'Hello Kiko, have a good Monday'
```

The real thing that you need is a **partial function**. The implementation depends of the library that you use but normally it's more faster than `.bind`:
The real thing that you need is a **partial function**. The implementation depends of the library that you use but normally it will be faster than `.bind`:

```js
function greet (greeting, name) {
Expand Down
4 changes: 2 additions & 2 deletions docs/function/new.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# new agnostic

You can force an `Object` constructor to return an instance of the `Object` even when the `new` keyword hasn't been used:
You can force an `Object` constructor to return an instance of the `Object` even if the `new` keyword hasn't been used:

```js
function User (name, passwordHash) {
Expand All @@ -24,4 +24,4 @@ y instanceof User // true
This behavior is also supported by default by some native types in order to be backward compatibility with the [ECMAScript](https://tc39.github.io/ecma262) specification, like:

- [RegExp constructor](https://tc39.github.io/ecma262/#sec-regexp-constructor).
- [Error constructor](https://tc39.github.io/ecma262/#sec-error-constructor).
- [Error constructor](https://tc39.github.io/ecma262/#sec-error-constructor).

0 comments on commit 2a2b42d

Please sign in to comment.