Skip to content

Minor improvements and fix typos for JS documentation #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions JS/JS-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ console.log(c.a);
// is another situation whom's priority is only second to `new`
```

Understanding the above several situstions , we won’t be confused by `this` in a lot of codes,then let’s take a look at `this` of arrow function
Understanding the above several situations , we won’t be confused by `this` in a lot of codes,then let’s take a look at `this` of arrow function
```js
function a() {
return () => {
Expand Down Expand Up @@ -633,7 +633,7 @@ const clone = await structuralClone(obj);

# Modularization

With Babel, we can directly use ES6's modularizaiton.
With Babel, we can directly use ES6's modularization.

```js
// file a.js
Expand Down Expand Up @@ -718,7 +718,7 @@ define(function(require, exports, module) {

Firstly, let’s tell the difference between the former two.

Both `call` and `apply` are used to change what `this` refers to.Their role is the same, but the way to pass the parameters is different.
Both `call` and `apply` are used to change what `this` refers to. Their role is the same, but the way to pass the parameters is different.

In addition to the first parameter, `call` can accept an argument list, while `apply` accepts a single array of arguments.

Expand Down Expand Up @@ -781,7 +781,7 @@ Function.prototype.myApply = function (context) {

The role of `bind` is the same as the other two, except that it returns a function. And we can implement currying with `bind`

let’s simulate `bind`
Let’s simulate `bind`

```js
Function.prototype.myBind = function (context) {
Expand Down Expand Up @@ -1063,7 +1063,7 @@ function test() {

# Debouncing

Have you ever encountered this problem in your development: how to do a complex computation in a rolling event or to prevent the "secend accidental click" on a button?
Have you ever encountered this problem in your development: how to do a complex computation in a rolling event or to prevent the "second accidental click" on a button?

These requirements can be achieved with function debouncing. Especially for the first one, if complex computations are carried out in frequent event callbacks, there's a large chance that the page becomes laggy. It's better to combine multiple computations into a single one, and only operate at a precise point in time. Since there are many libraries that implement debouncing, we won't build our own here and will just take underscore's source code to explain debouncing.

Expand Down