{"action":"created","comment":{"url":"https://api.github.com/repos/xitu/gold-miner/pulls/comments/185384085","pull_request_review_id":116746968,"id":185384085,"diff_hunk":"@@ -122,561 +122,561 @@ console.log(name1()); // ?\n console.log(name2.print()) // ?\n ```\n \n-Write down your expected answers for the `console.log()` outputs. If you are not sure, review the previous section.\n+`console.log()` 将会输出什么，把你的答案写下来。如果你还想不清楚，复习下上一节。\n \n-Once you are ready, feel free to check out the answers below.\n+准备好了吗？放松心情，我们来看下面的答案。\n \n-### Answers and Explanations\n+### 答案和解析\n \n ##### person.details.print()\n \n-Before we proceed, who/what is calling print? In JavaScript, we read from left to right. Therefore, this points at `details` not `person`. This is an important distinction to make, so bear it in mind if this is something new to you.\n+首先，谁调用了 print 函数？在 JavaScript 中我们都是从左读到右。于是 this 指向 `details` 而不是 `person`。这是一个很重要的区别，如果你对这个感到陌生，那赶紧把它记下。\n \n-The `print` key in `details` holds a function that returns `this.name`. Since we have identified that this refers to details, the function should return the value `'Jay Details'`.\n+`print` 作为 `details` 对象的一个 key，指向一个返回 `this.name` 的函数。既然我们已经找出 this 指向 details ，那函数的输出就应该是 `'Jay Details'`。\n \n ##### person.print()\n \n-Once again, identify what `this` is pointing at. `print()` is being called on the `person` object right?\n+再来一次，找出 `this` 的指向。`print()` 是被 `person` 对象调用的，没错吧？\n \n-In this case, the `print` function on `person` returns `this.name`. `this` is currently pointing at `person`, so “`Jay Person`” will be returned.\n+在这种情况，`person` 里的 `print` 函数返回 `this.name`。`this` 现在指向 `person` 了，那 `'Jay Person'` 就是返回值。\n \n ##### console.log(name1)\n \n-This one can be a little tricky. In the previous line, we have the following pieces of code.\n+这一题就有点狡猾了。在上一行有这样一句代码：\n \n ```\n var name1 = person.print;\n ```\n \n-I won’t blame you if that is what you thought. Unfortunately, it is wrong. Remember, the `this` keyword is bound when the function is called. What is in front of `name1()`? Nothing. Therefore, the `this` keyword is going to point at the global `window` object.\n+如果你是通过这句来思考的，我不会怪你。很遗憾，这样去想是错的。要记住，`this` 关键词是在函数调用时才做绑定的。`name1()` 前面是什么？什么都没有。因此 `this` 关键词就将指向全局的 `window` 对象去。\n \n-Therefore, the answer is “`Jay Global`”.\n+因此，答案是 `'Jay Global'`。\n \n-##### person.print()\n+##### name2.print()\n \n-Take a look at the object that `name2` is pointing at. It is the `details` object right?\n+看一下 `name2` 指向哪个对象，是 `details` 对象没错吧？\n \n-So what will the following print? If you understood all the material up until now, this should come quite naturally if you put your mind to it.\n+所以下面这句会打印出什么呢？如果到目前为止的所有小点你都理解了，那这里稍微思考下你就自然有答案了。\n \n ```\n console.log(name2.print()) // ??\n ```\n \n-The answer is “`Jay Details`” because print is called on `name2` which points at `details`.\n+答案是 `'Jay Details'`，因为 `print` 是 `name2` 调起的，而 `name2` 指向 `details`。\n \n-### Lexical Scope\n+### 词法作用域\n \n-You might be asking: **What is lexical scope**?\n+你可能会被问：“什么是词法作用域？”\n \n-Heck, why are we even covering it when we are focusing on understanding the JavaScript `this` keyword? Well, it comes into play when we start working with ES6’s arrow functions. If you have written JavaScript for a year or more, chances are, you have come across arrow functions. And they will be used more and more as ES6 becomes more standardized.\n+逗我呢，我们不是在探讨 `this` 关键词吗，这个又是哪里冒出来的？好吧，当我们用起 ES6 的箭头函数，这个就要考虑了。如果你已经写了不止一年的 JavaScript，那你很可能已经碰到箭头函数。随着 ES6 逐渐成为现实标准，箭头函数也变得越来越常用。\n \n-[Lexical scope in JavaScript](https://toddmotto.com/everything-you-wanted-to-know-about-javascript-scope/#lexical-scope) can be confusing to grasp. If you [understand closures](https://www.thecodingdelight.com/javascript-closure/), it will be much easier to conceptualize. Let’s take a look at a brief code snippet.\n+[JavaScript 的词法作用域](https://toddmotto.com/everything-you-wanted-to-know-about-javascript-scope/#lexical-scope) 并不好懂。 如果你 [理解闭包](https://www.thecodingdelight.com/javascript-closure/)，那要理解这个概念就容易多了。来看下下面的小段代码。 \n \n ```\n-// lexical scope of outerFn\n+// outerFn 的词法作用域\n var outerFn = function() {\n-var n = 5;\n-console.log(innerItem);\n-// lexical scope of innerFn\n-var innerFn = function() {  \n-var innerItem = \"inner\";    // Error. Can only go upwards with the elevator. Not downwards.\n-console.log(n);\n-};\n-return innerFn;\n+    var n = 5;\n+    console.log(innerItem);\n+    // innerFn 的词法作用域\n+    var innerFn = function() {  \n+        var innerItem = \"inner\";    // 错了。只能坐着电梯向上，不能向下。\n+        console.log(n);\n+    };\n+    return innerFn;\n };\n outerFn()();\n ```\n \n-Think of a building with a crappy elevator that can only travel upwards.\n+想象一下一栋楼里面有一架只能向上走的诡异电梯。\n \n-[![JavaScript lexical scope is a lot like a building with an elevator that only goes up](//personalzone-hulgokm2zfcmm9u.netdna-ssl.com/wp-content/uploads/2018/03/JavaScript-lexical-scope-building.jpg)](//personalzone-hulgokm2zfcmm9u.netdna-ssl.com/wp-content/uploads/2018/03/JavaScript-lexical-scope-building.jpg)\n+[![JavaScript lexical scope is a lot like a building with an elevator that only goes up](https://personalzone-hulgokm2zfcmm9u.netdna-ssl.com/wp-content/uploads/2018/03/JavaScript-lexical-scope-building.jpg)](https://personalzone-hulgokm2zfcmm9u.netdna-ssl.com/wp-content/uploads/2018/03/JavaScript-lexical-scope-building.jpg)\n \n-The top floor of a building is the global windows object. If you are on the first floor, you are able to see and access the items in the upper floors such as those stored the second and third floor (`outerFn` and the global `window` object).\n+建筑的顶层就是全局 windows 对象。如果你现在在一楼，你就可以看到并访问那些放在楼上的东西，比如放在二楼的 `outerFn` 和放在三楼的 `window` 对象。\n \n-That is why when we run the following code: `outerFn()()`; it logs 5 onto the console and not `undefined`.\n+这就是为什么我们执行代码 `outerFn()()`，它在控制台打出了 5 而不是 `undefined`。\n \n-However, when we try to log `innerItem` from the `outerFn` lexical scope, we get the following error. Remember, the lexical scope in JavaScript is like a crappy elevator in a building that can only move upwards. Since outerFn is one lexical scope above the innerFn, it cannot go down into the innerFn lexical scope and retrieve the value inside of it. Which is why we get the following error:\n+然而，当我们试着在 `outerFn` 词法作用域下打出日志 `innerItem`，我们遇到了下面的报错。请记住，JavaScript 的词法作用域就好像建筑里面那个只能向上走的诡异电梯。由于 outerFn 的词法作用域在 innerFn 上面，所以它不能向下走到 innerFn 的词法作用域里面并拿到里面的值。这就是触发下面报错的原因：\n \n ```\n test.html:304 Uncaught ReferenceError: innerItem is not defined\n at outerFn (test.html:304)\n at test.html:313\n ```\n \n-### `this` and Arrow Functions\n+### `this` 和箭头函数\n \n-In [ES6](http://es6-features.org/#ExpressionBodies), whether you like it or not, [arrow functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) were introduced. For those that are not yet accustomed to arrow functions or are new to JavaScript, how it behaves in conjunction with the `this` keyword may cause you some confusion and potentially grief, this section is dedicated to you!\n+在 [ES6](http://es6-features.org/#ExpressionBodies) 里面，不管你喜欢与否，[箭头函数](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions)被引入了进来。对于那些还没用惯箭头函数或者新学 JavaScript 的人来说，当箭头函数和 `this` 关键词混合使用时会发生什么，这个点可能会给你带来小小的困惑和淡淡的忧伤。那这个小节就是为你们准备的！\n \n-> What is the main difference between _arrow functions_ and _regular functions_ when it comes to the `this` keyword?\n+> 当涉及到 `this` 关键词，_箭头函数_ 和 _普通函数_ 主要的不同是什么？\n \n-**Answer**:\n+**回答：**\n \n-> Arrow Functions **lexically** bind their context so `this` actually refers to the originating context.\n+> 箭头函数按**词法作用域**来绑定它的上下文，所以 `this` 实际上会引用到原来的上下文。\n > \n-> source: [hackernoon.com](https://hackernoon.com/javascript-es6-arrow-functions-and-lexical-this-f2a3e2a5e8c4)\n+> 引自：[hackernoon.com](https://hackernoon.com/javascript-es6-arrow-functions-and-lexical-this-f2a3e2a5e8c4)\n \n-I couldn’t have said it any better.\n+我实在没法给出比这个更好的总结。\n \n-Arrow functions preserve the [lexical scope](https://stackoverflow.com/questions/1047454/what-is-lexical-scope) of its current execution context, while regular functions don’t. In other words, arrow functions derive the value of `this` from the lexical scope that contains the arrow function.\n+箭头函数保持它当前执行上下文的[词法作用域](https://stackoverflow.com/questions/1047454/what-is-lexical-scope)不变，而普通函数则不会。换句话说，箭头函数从包含它的词法作用域中继承到了 `this` 的值。\n \n-Let’s examine a few code snippets to ensure that you properly understand this. Understanding how this works (no pun intended) will save you a lot of headaches in the future, as the `this` keyword and arrow functions are used in conjunction quite regularly.\n+我们不妨来测试一些代码片段，确保你真的理解了。想清楚这块知识点未来会让你少点头痛，因为你会发现 `this` 关键词和箭头函数太太太经常一起用了。\n \n-### Example\n+### 示例\n \n-Take a look at the following code snippet carefully.\n+仔细阅读下面的代码片段。\n \n ```\n var object = {\n-data: [1,2,3],\n-dataDouble: [1,2,3],\n-double: function() {\n-console.log(\"this inside of outerFn double()\");\n-console.log(this);\n-return this.data.map(function(item) {\n-console.log(this);      // What is this ???\n-return item * 2;\n-});\n-},\n-doubleArrow: function() {\n-console.log(\"this inside of outerFn doubleArrow()\");\n-console.log(this);\n-return this.dataDouble.map(item => {\n-console.log(this);      // What is this ???\n-return item * 2;\n-});\n-}\n+    data: [1,2,3],\n+    dataDouble: [1,2,3],\n+    double: function() {\n+        console.log(\"this inside of outerFn double()\");\n+        console.log(this);\n+        return this.data.map(function(item) {\n+            console.log(this);      // 这里的 this 是什么？？\n+            return item * 2;\n+        });\n+    },\n+    doubleArrow: function() {\n+        console.log(\"this inside of outerFn doubleArrow()\");\n+        console.log(this);\n+        return this.dataDouble.map(item => {\n+            console.log(this);      // 这里的 this 是什么？？\n+            return item * 2;\n+        });\n+    }\n };\n object.double();\n object.doubleArrow();\n ```\n \n-If we look at the execution context, both of these are called on `object`. So, it is safe to assume that this inside of the two function refers to `object` right? Yes, but I recommend you to copy and paste this code and test it yourself.\n+如果我们看执行上下文，那这两个函数都是被 `object` 调用的。所以，就此断定这两个函数里面的 this 都指向 `object` 不为过吧？是的，但我建议你拷贝这段代码然后自己测一下。\n \n-Here is the big question\n+这里有个大问题：\n \n-> What does `this` point at inside of the inner `map` function inside `arrow()` and `doubleArrow()`?\n+> `arrow()` 和 `doubleArrow()` 里面的 `map` 函数里面的 `this` 又指向哪里呢？\n \n-[![this and arrow function](//personalzone-hulgokm2zfcmm9u.netdna-ssl.com/wp-content/uploads/2018/03/this-and-arrow-function.jpg)](//personalzone-hulgokm2zfcmm9u.netdna-ssl.com/wp-content/uploads/2018/03/this-and-arrow-function.jpg)\n+[![this 和箭头函数](https://personalzone-hulgokm2zfcmm9u.netdna-ssl.com/wp-content/uploads/2018/03/this-and-arrow-function.jpg)](https://personalzone-hulgokm2zfcmm9u.netdna-ssl.com/wp-content/uploads/2018/03/this-and-arrow-function.jpg)\n \n-The following image should provide a huge hint. If you are not sure, please take around 5 minutes to think about what we have discussed in previous section. Afterwards, write down your answer to what you think this points to before proceeding. In the following section, we will answer the question.\n+上一张图已经给了一个大大的提示。如果你还不确定，那请花5分钟将我们上一节讨论的内容再好好想想。然后，根据你的理解，在实际执行代码前把你认为的 this 应该指向哪里写下来。在下一节我们将会回答这个问题。\n \n-### Revision of Execution Context\n+### 回顾执行上下文\n \n-The title should already have given it away. In case you don’t know, the map function iterates through the array that it is called upon and applies the return value of the passed in callback to each of its items. [Read more about JavaScript’s map function](https://www.thecodingdelight.com/functional-programming-javascript-map/) if you are unsure or are just curious.\n+这个标题已经把答案泄露出来了。在你看不到的地方，map 函数对调用它的数组进行遍历，将数组的每一项传到回调函数里面并把执行结果返回。如果你对 JavaScript 的 map 函数不太了解或有所好奇，可以读读[这个](https://www.thecodingdelight.com/functional-programming-javascript-map/)了解更多。\n \n-Anyhow, since `map()` is called on `this.data`, this will point at the array stored inside of the `data` key, which is `[1,2,3]`. Using the same logic, `this.dataDouble` should point at another array with the data `[1,2,3]`.\n+总之，由于 `map()` 是被 `this.data` 调起的，于是 this 将指向那个存储在 `data` 这个 key 里面的数组，即 `[1,2,3]`。同样的逻辑，`this.dataDouble` 应该指向另一个数组，值为 `[1,2,3]`。\n \n-Now, if the function call is made on `object`, we have established that this refers to `object` right? Okay, let’s move onto the following code snippet.\n+现在，如果函数是 `object` 调用的，我们已经确定 this 指向 `object` 对吧？好，那来看看下面的代码片段。\n \n ```\n double: function() {\n-return this.data.map(function(item) {\n-console.log(this);      // What is this ???\n-return item * 2;\n-});\n+    return this.data.map(function(item) {\n+        console.log(this);      // 这里的 this 是什么？？\n+        return item * 2;\n+    });\n }\n ```\n \n-Here is a trick question: who is calling the [anonymous function](https://en.wikibooks.org/wiki/JavaScript/Anonymous_functions) passed to `map()`? The answer is: no object is. To make things clear, here is a basic implementation of the `map` function.\n+这里有个很有迷惑性的问题：传给 `map()` 的那个[匿名函数](https://en.wikibooks.org/wiki/JavaScript/Anonymous_functions)是谁调用的？答案是：这里没有一个对象是。为了看得更明白，这里给出一个 `map` 函数的基本实现。\n \n ```\n // Array.map polyfill\n if (Array.prototype.map === undefined) {\n-Array.prototype.map = function(fn) {\n-var rv = [];\n-for(var i=0, l=this.length; i<l; i++)\n-rv.push(fn(this[i]));\n-return rv;\n-};\n+    Array.prototype.map = function(fn) {\n+        var rv = [];\n+        for(var i=0, l=this.length; i<l; i++)\n+            rv.push(fn(this[i]));\n+        return rv;\n+    };\n }\n ```\n \n-Is there any object in front of `fn(this[i]));`? Therefore, the `this` keyword refers to the global windows object. Then, why does `this.dataDouble.map` using an arrow function has this pointing at `object`?\n+`fn(this[i]));` 前面有什么对象吗？没。因此，`this` 关键词指向全局的 windows 对象。那，为什么 `this.dataDouble.map` 使用了箭头函数会使得 this 指向 `object` 呢？\n \n-I will say it again, because it it that important:\n+我想再说一遍这句话，因为它实在很重要：\n \n-> Arrow Functions Lexically Bind their Context to the <span style=\"text-decoration: underline;\">**Originating Context**</span>\n+> 箭头函数按词法作用域将它的上下文绑定到 <span style=\"text-decoration: underline;\">**原来的上下文**</span>\n \n-Now, you might be asking: what is the originating context? Good question!\n+现在，你可能会问：原来的上下文是什么？问得好！\n \n-Who is the original caller of `doubleArrow()`? `object` right? That is the originating context 🙂\n+谁是 `doubleArrow()` 的初始调用者？就是 `object` 对吧？那它就是原来的上下文 🙂\n \n-## this and `use strict`\n+## this 和 `use strict`\n \n-In ES5, the [strict mode](https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/dev-guides/hh673540(v=vs.85)) feature was added in order to make the language more robust and minimize human errors. One prime example is with the relationship between how this behaves in strict mode. In order to write your code in strict mode, all you have to do is write the string `\"use strict\";` at the top of the scope that you are working with.\n+为了让 JavaScript 更加健壮及尽量减少人为出错，ES5 引进了[严格模式](https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/dev-guides/hh673540(v=vs.85))。一个典型的例子就是 this 在严格模式下的表现。你如果想按照严格模式来写代码，你只需要在你正在写的代码的作用域最顶端加上这么一行 `\"use strict;\"`。\n \n-Remember that JavaScript is traditionally function scoped, not block scoped. For example,\n+记住，传统的 JavaScript 只有函数作用域，没有块作用域。举个例子：\n \n ```\n function strict() {\n-// Function-level strict mode syntax\n-'use strict';\n-function nested() { return 'And so am I!'; }\n-return \"Hi!  I'm a strict mode function!  \" + nested();\n+    // 函数级严格模式写法\n+    'use strict';\n+    function nested() { return 'And so am I!'; }\n+    return \"Hi!  I'm a strict mode function!  \" + nested();\n }\n function notStrict() { return \"I'm not strict.\"; }\n ```\n \n-Code snippet provided by [Mozilla Developer Network.](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode)\n+代码片段来自 [Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode)。\n \n-Although block scoping can be achieved with the features that ES6 provides such as the [let keyword](https://www.thecodingdelight.com/javascript-es6-best-parts/#ftoc-heading-7).\n+不过呢，ES6 里面通过 [let 关键词](https://www.thecodingdelight.com/javascript-es6-best-parts/#ftoc-heading-7)提供了块作用域的特性。\n \n-Now, let’s look at a simple code snippet to see how this behaves in strict mode and out of strict mode. Please run the code snippet below before proceeding.\n+现在，来看一段简单代码，看下 this 在严格模式和非严格模式下会怎么表现。在继续之前，请将下面的代码运行一下。\n \n ```\n (function() {\n-\"use strict\";\n-console.log(this);\n+    \"use strict\";\n+    console.log(this);\n })();\n (function() {\n-// Without strict mode\n-console.log(this);\n+    // 不使用严格模式\n+    console.log(this);\n })();\n ```\n \n-As you saw, `this` points at `undefined` in strict mode. In contrast, `this` points at the global `window` object without strict mode. In most cases, when users use this, they don’t want it to point at the global window object. Strict mode greatly reduces the possibility of developers shooting themselves in the foot when using the `this` keyword.\n+正如你看到的，`this` 在严格模式下指向 `undefined`。相对的，非严格模式下 `this` 指向全局变量 `window`。大部分情况下，开发者使用 this ，并不希望它指向全局 window 对象。严格模式帮我们在使用 `this` 关键词时，尽量少做搬起石头砸自己脚的蠢事。\n \n-For example, what if the global window object has a property with the same key value as the one that you are using in your object? For example\n+举个例子，如果全局的 window 对象刚好有一个 key 的名字和你希望访问到的对象的 key 相同，会怎样？上代码吧：\n \n ```\n (function() {\n-// \"use strict\";\n-var item = {\n-document: \"My document\",\n-getDoc: function() {\n-return this.document;\n-}\n-}\n-var getDoc = item.getDoc;\n-console.log(getDoc());\n+    // \"use strict\";\n+    var item = {\n+        document: \"My document\",\n+        getDoc: function() {\n+            return this.document;\n+        }\n+    }\n+    var getDoc = item.getDoc;\n+    console.log(getDoc());\n })();\n ```\n \n-There are two problems in this code.\n+这段代码有两个问题。\n \n-1.  `this` will not point at `item` on line 10.\n-2.  If the program is run without strict mode, no error will be thrown, since the `document` object is a property of the global `window` object.\n+1.  `this` 将不会指向 `item`。\n+2.  如果程序在非严格模式下运行，将不会有错误抛出，因为全局的 `window` 对象也有一个名为 `document` 的属性。\n \n-In this simple example, it won’t be much of a problem, since the code snippet is very small.\n+在这个简单示例中，因为代码较短也就不会形成大问题。\n \n-If you run code like this in production, when working with the item stored in `getDoc`, you will see a firework of errors that will be fairly difficult to trace, especially if the codebase is large has a lot of interactions between objects.\n+如果你是在生产环境像上面那样写，当用到 `getDoc` 返回的数据时，你将收获一堆难以定位的报错。如果你代码库比较大，对象间互动比较多，那问题就更严重了。\n \n-Fortunately, if we run the code snippet in strict mode, since this is `undefined`, it will immediately throw an error back at us.\n+值得庆幸的是，如果我们是在严格模式下跑这段代码，由于 this 是 `undefined`，于是立刻就有一个报错抛给我们：\n \n > `test.html:312 Uncaught TypeError: Cannot read property 'document' of undefined`\n > `at getDoc (test.html:312)`\n > `at test.html:316`\n > `at test.html:317`\n \n-## Explicitly Setting the Execution Context\n+## 明确设置执行上下文\n \n-We have talked a lot about execution context and the this keyword assuming that nobody was explicitly manipulating the execution context.\n+先前假定大家都对执行上下文不熟，于是我们聊了很多关于执行上下文和 this 的知识。\n \n-What can be both a blessing and a curse in JavaScript is that this “**call/execution context**” can be manipulated directly by a developer using JavaScript’s built-in features. They are\n+让人欢喜让人忧的是，在 JavaScript 中通过使用内置的特性开发者就可以直接操作**执行上下文**了。这些特性包括：\n \n-*   [bind()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind): Explicitly set the `this` value to an object of your choice without calling the function. Pass in n number of arguments delimited by the comma character (,). E.g. `func.bind(this, param1, param2, ...)`.\n-*   [apply()](https://www.w3schools.com/js/js_function_apply.asp): Explicitly set the `this` value to an object of your choice. The second parameter is an array containing all the arguments that you would like to pass to the function. Lastly, **call the function**.\n-*   [call()](https://docs.microsoft.com/en-us/scripting/javascript/reference/call-method-function-javascript): Explicitly set the `this` value to an object of your choice and like `bind`, pass in a number of arguments using the comma delimiter. E.g. `print.call(this, param1, param2, ...)`;. Lastly, **call the function**.\n+*   [bind()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind)：不需要执行函数就可以将 `this` 的值准确设置到你选择的一个对象上。还可以通过逗号隔开传递多个参数，如 `func.bind(this, param1, param2, ...)` 。\n+*   [apply()](https://www.w3schools.com/js/js_function_apply.asp)：将 `this` 的值准确设置到你选择的一个对象上。第二个参数是一个数组，数组的每一项是你希望传递给函数的参数。最后，**执行函数**。\n+*   [call()](https://docs.microsoft.com/en-us/scripting/javascript/reference/call-method-function-javascript)：将 `this` 的值准确设置到你选择的一个对象上，然后想 `bind` 一样通过逗号分隔传递多个参数给函数。如：`print.call(this, param1, param2, ...)`。最后，**执行函数**。\n \n-All the built-in functions mentioned above have a commonality in that they are used to make the `this` keyword point to something else. These features enable us to do some really cool things. Unfortunately, the topic is so broad that it will require many posts to cover all of them, so for the sake of brevity, I will not blab on about its application points in this post.\n+上面提到的所有内置函数都有一个共同点，就是它们都是用来将 `this` 关键词指向到其他地方。这些特性可以让我们玩一些骚操作。只是呢，这个话题太广了都够写好几篇文章了，所以简洁起见，这篇文章我不打算展开它的实际应用。\n \n-**Note**: Out of the three functions mentioned above, only `bind()` does not directly call the function after setting the `this` keyword.\n+**重点**：上面那三个函数，只有 `bind()` 在设置好 `this` 关键词后不立刻执行函数。\n \n-## When to Use Bind, Call and Apply\n+## 什么时候用 bind、call 和 apply\n \n-You are probably thinking: This is confusing as it is already. What is the purpose of learning all of this?\n+你可能在想：现在已经很乱了，学习所有这些的目的是什么？\n \n-First of all, you will see bind, call and apply used everywhere, especially in large libraries and frameworks. If you don’t understand what it does, you are woefully utilizing only a small part of the power JavaScript offers.\n+首先，你会看到 bind、call 和 apply 这几个函数到处都会用到，特别是在一些大型的库和框架。如果你没理解它做了些什么，那可怜的你就只用上了 JavaScript 提供的强大能力的一小部分而已。\n \n-If you don’t want to read about possible usages and want to get into learning right away, feel free to skip this section.\n+如果你不想了解一些可能的用法而想立刻读下去，当然了，你可以直接跳过这节，没关系。\n \n-A lot of the possible usages listed below are very broad and deep topics (most likely unable to be covered in a single post), so if you want to learn more about them, I will attach links. In the future, I might add sections to this ultimate guide, so that people can get the most out of it.\n+下面列出来的应用场景都是一些具有深度和广度的话题（一篇文章基本上是讲不完的），所以我放了一些链接供你深度阅读用。未来我可能会在这篇终极指南里面继续添加新的小节，这样大家就可以一次看过瘾。\n \n-1.  [Borrowing methods](https://medium.com/@thejasonfile/borrowing-methods-from-a-function-in-javascript-713a0beed40d)\n-2.  [Currying](https://www.sitepoint.com/currying-in-functional-javascript/)\n-3.  [Partial application](http://benalman.com/news/2012/09/partial-application-in-javascript/#partial-application)\n-4.  [Dependency injection](http://krasimirtsonev.com/blog/article/Dependency-injection-in-JavaScript)\n+1.  [方法借用](https://medium.com/@thejasonfile/borrowing-methods-from-a-function-in-javascript-713a0beed40d)\n+2.  [柯里化](https://www.sitepoint.com/currying-in-functional-javascript/)\n+3.  [偏函数应用](http://benalman.com/news/2012/09/partial-application-in-javascript/#partial-application)\n+4.  [依赖注入](http://krasimirtsonev.com/blog/article/Dependency-injection-in-JavaScript)\n \n-If I am missing any other practical use cases, please leave a message and let me know. I am always out to improve the guides so that you as a reader can get the most out of reading.\n+如果我漏掉了其他实践案例，请留言告知。我会经常来优化这篇指南，这样你作为读者就可以读到最丰富的内容。\n \n-> Read high quality open source code to take your knowledge and skills to the next level.\n+> 阅读高质量的开源代码可以升级你的知识和技能。\n \n-Seriously, you will see some real practical application of the this keyword, call, apply, bind in some open source code. I talk about this along with other methods of [becoming a better programmer](https://www.thecodingdelight.com/become-better-programmer/).\n+讲真，你会在一些开源代码上看到 this 关键词、call、apply 和 bind 的实际应用。我会将这块结合着其他能[帮你成为更好的程序员](https://www.thecodingdelight.com/become-better-programmer/)的方法一起讲。\n \n-In my opinion, the best open source to start reading is [underscore](http://underscorejs.org/). It isn’t monolithic compared to other open source projects like [d3](https://github.com/d3/d3), so it is perfect for educational purposes. Furthermore, it is compact, well-documented and the coding style is relatively easy to follow.\n+在我看来，开始阅读最好的开源代码是 [underscore](http://underscorejs.org/)。它并不像其他开源项目，如 [d3](https://github.com/d3/d3)，那样铁板一块，因而它是教学用的最佳选择。另外，它代码简洁，文档详细，编码风格也是相当容易学习。\n \n-## JavaScript `this` and bind\n+## JavaScript 的 `this` 和 bind\n \n-As mentioned, `bind` allows you to explicitly set what this points at without actually calling the function. Here is a simple example\n+前面提到了，`bind` 允许你明确设定 this 的指向而不用实际去执行函数。这里是一个简单示例：\n \n ```\n var bobObj = {\n-name: \"Bob\"\n+    name: \"Bob\"\n };\n function print() {\n-return this.name;\n+    return this.name;\n }\n-// explicitly set this to point at \"bobObj\"\n+// 将 this 明确指向 \"bobObj\"\n var printNameBob = print.bind(bobObj);\n-console.log(printNameBob());    // this points at bob, so logs \"Bob\"\n+console.log(printNameBob());    // this 会指向 bob，于是输出结果是 \"Bob\"\n ```\n \n-In the example above, if we were to remove the bind method, then this would point at the global `window` object.\n+在上面的示例中，如果你把 bind 那行去掉，那 this 将会指向全局 `window` 对象。\n \n-This might sound very stupid, but you should use `bind` when you want to bind the `this` object to a specific object. In some cases, we may want to borrow methods from another objects. For example,\n+这好像很蠢，但在你想将 `this` 绑定到具体对象前你就必须用 `bind` 来绑定。在某些场景下，我们可能想从另一个对象中借用一些方法。举个例子，\n \n ```\n var obj1 = {\n-data: [1,2,3],\n-printFirstData: function() {\n-if (this.data.length)\n-return this.data[0];\n-}\n+    data: [1,2,3],\n+    printFirstData: function() {\n+        if (this.data.length)\n+            return this.data[0];\n+    }\n };\n var obj2 = {\n-data: [4,5,6],\n-printSecondData: function() {\n-if (this.data.length > 1)\n-return this.data[1];\n-}\n+    data: [4,5,6],\n+    printSecondData: function() {\n+        if (this.data.length > 1)\n+            return this.data[1];\n+    }\n };\n-// get access to obj'2 method to use for obj1;\n+// 在 obj1 中借用 obj2 的方法\n var getSecondData = obj2.printSecondData.bind(obj1);\n-console.log(getSecondData());   // prints 2\n+console.log(getSecondData());   // 输出 2\n ```\n \n-In the sample code snippet, the `obj2` has a method called `printSecondData` which we want to lend to `obj1`. In the following line\n+在这个代码片段里，`obj2` 有一个名为 `printSecondData` 的方法，而我们想将这个方法借给 `obj1`。在下一行\n \n ```\n var getSecondData = obj2.printSecondData.bind(obj1);\n ```\n \n-we are using the power of bind to give `obj1` access to the `printSecondData` method on `obj2`.\n+通过使用 bind ，我们让 `obj1` 可以访问 `obj2` 的 `printSecondData` 方法。\n \n-### Exercise\n+### 练习\n \n-In the code below\n+在下面的代码中\n \n ```\n var object = {\n-data: [1,2,3],\n-double: function() {\n-this.data.forEach(function() {\n-// Get this to point to object.\n-console.log(this);\n-});\n-}\n+    data: [1,2,3],\n+    double: function() {\n+        this.data.forEach(function() {\n+            // Get this to point to object.\n+            console.log(this);\n+        });\n+    }\n };\n object.double();\n ```\n \n-Have the this keyword point at `object`. Hint: You do not have to rewrite `this.data.forEach`.\n+怎么让 this 关键词指向 `object`。提示：你并不需要重写 `this.data.forEach`。\n \n-##### Answer\n+##### 答案\n \n-In one of the previous section, we need to be aware of execution context. If you look closely at how the anonymous function is called, it is not called as a method of a object. Therefore, the `this` keyword will point at the global `window` object.\n+在上一节中，我们了解了执行上下文。如果你对匿名函数调用那部分看得够细心，你就知道它并不会作为某个对象的方法被调用。因此，`this` 关键词指向了全局 `window` 对象。\n \n-Therefore, we need to bind object as the context to the anonymous function so that this points to `object`. now, when `double` runs, `object` is calling it, so the `this` inside of `double` when `object.double` is called is `object`.\n+于是我们需要将 object 作为上下文绑定到匿名函数上，使得里面的 this 指向 `object`。现在，`double` 函数跑起来时，是 `object` 调用了它，那么 `double` 里面的 `this` 指向 `object`。\n \n ```\n var object = {\n-data: [1,2,3],\n-double: function() {\n-return this.data.forEach(function() {\n-// Get this to point to object.\n-console.log(this);\n-}.bind(this));\n-}\n+    data: [1,2,3],\n+    double: function() {\n+        return this.data.forEach(function() {\n+            // Get this to point to object.\n+            console.log(this);\n+        }.bind(this));\n+    }\n };\n object.double();\n ```\n \n-However, what happens if we do the following?\n+那，如果我们像下面这样做呢？\n \n ```\n var double = object.double;\n-double();   // ??\n+double();   // ？？\n ```\n \n-What is the call context of `double()`? It is the global context. Therefore, we will get the following error.\n+`double()` 的调用上下文是什么？是全局上下文。于是，我们就会看到下面的报错。\n \n > `Uncaught TypeError: Cannot read property 'forEach' of undefined`\n > `at double (test.html:282)`\n > `at test.html:289`\n \n-So, we need to be mindful of how we call functions when using the `this` keyword. We can reduce the possibility of this kind of error by providing an API to users that fixes the this keyword. Remember that this comes at the expense of flexibility, so count the costs before making a decision.\n+所以，当我们用到 `this` 关键词时，就要小心在意我们调用函数的方式。我们可以在提供 API 给用户时固定 this 关键词，以此减少这种类型的错误。但请记住，这么做的代价是牺牲了灵活性，所以做决定前要考虑清楚。\n \n ```\n var double = object.double.bind(object);\n-double();  // no more error\n+double();  // 不再报错\n ```\n \n-## JavaScript `this` and call\n+## JavaScript `this` 和 call\n \n-The call method is very similar to bind, but the big difference is that `call`, as the name implies, immediately calls/executes the function.\n+call 方法和 bind 很相似，但就如它名字所暗示的，`call` 会立刻呼起（执行）函数，这是两个函数的最大区别。\n \n ```\n var item = {\n-name: \"I am\"\n+    name: \"I am\"\n };\n function print() {\n-return this.name;\n+    return this.name;\n }\n-// executed right away\n+// 立刻执行\n var printNameBob = console.log(print.call(item));\n ```\n \n-Most of the use cases with `call`, `apply` and `bind` will overlap. The most important thing as a programmer is to first understand the differences between the three methods and use them according to their design and purpose. Once you understand, you will be able to use them creatively in your code to create powerful constructs.\n+`call`、`apply`、`bind` 大部分使用场景是重叠的。作为一个程序员最重要的还是先了解清楚这三个方法之间的差异，从而能根据它们的设计和目的的不同来选用。只要你了解清楚了，你就可以用一种更有创意的方式来使用它们，写出更独到精彩的代码。\n \n-When working with fixed amount of arguments, it is good to use `call` or `bind`. For example, a `doLogin` function will accept two arguments always: `username` and `password`. In this case, if you need to bind this to a specific object, `call` or `bind` will serve you well.\n+在参数数量固定的场景，`call` 或 `bind` 是不错的选择。比如说，一个叫 `doLogin` 的函数经常是接受两个参数：`username` 和 `password`。在这个场景下，如果你需要将 this 绑定到一个特定的对象上，`call` 或 `bind` 会挺好用的。\n \n-### How to use call\n+### 如何使用 call\n \n-One of the most common uses in the past was to convert array-like objects such as the `arguments` object into arrays. For example,\n+以前一个最常用的场景是把一个类数组对象，比如 `arguments` 对象，转化成数组。举个例子：\n \n ```\n function convertArgs() {\n-var convertedArgs = Array.prototype.slice.call(arguments);\n-console.log(arguments);\n-console.log(Array.isArray(arguments));  // false\n-console.log(convertedArgs);\n-console.log(Array.isArray(convertedArgs)); // true\n+    var convertedArgs = Array.prototype.slice.call(arguments);\n+    console.log(arguments);\n+    console.log(Array.isArray(arguments));  // false\n+    console.log(convertedArgs);\n+    console.log(Array.isArray(convertedArgs)); // true\n }\n convertArgs(1,2,3,4);\n ```\n \n-In the example above, we used call to convert the `argument` object into an array. In the next example, we will call a method available on the `Array` object, setting the argument object as the this in its method to add up the arguments passed.\n+在上面的例子中，我们使用 call 将 `argument` 对象转化成一个数组。在下一个例子中，我们将会调用一个 `Array` 对象的方法，并将 argument 对象设置为方法的 this，以此来将传进来参数加在一起。\n \n ```\n function add (a, b) { \n-return a + b; \n+    return a + b; \n }\n function sum() {\n-return Array.prototype.reduce.call(arguments, add);\n+    return Array.prototype.reduce.call(arguments, add);\n }\n console.log(sum(1,2,3,4)); // 10\n ```\n \n-We are calling reduce on an array like object. Note that arguments is not an array, but we are giving it access to the reduce method. If you are curious about how reduce works, you can [read about reduce here](https://www.thecodingdelight.com/map-filter-reduce/).\n+我们在一个类数组对象上调用了 reduce 函数。要知道 arguments 不是一个数组，但我们给了它调用 reduce 方法的能力。如果你对 reduce 感兴趣，可以在[这里了解更多](https://www.thecodingdelight.com/map-filter-reduce/)。\n \n-### Exercises\n+### 练习\n \n-Now, it is time to solidify your newfound knowledge.\n+现在是时候巩固下你新学到的知识。\n \n-1.  [document.querySelectorAll()](https://www.w3schools.com/jsref/met_document_queryselectorall.asp) returns a `NodeList`, which is an array like object. Write a function that takes a CSS selector and returns an array of Nodes selected.\n-2.  Create a function that accepts an array of key value pairs and sets the value to the item that this keyword is pointing at and return that object. If this is `null` or `undefined`, create a new `object`. E.g. `set.call( {name: \"jay\"}, {age: 10, email: '[[email protected]](/cdn-cgi/l/email-protection)'}); // return {name: \"jay\", age: 10, email: '[[email protected]](/cdn-cgi/l/email-protection)'}`\n+1.  [document.querySelectorAll()](https://www.w3schools.com/jsref/met_document_queryselectorall.asp) 返回一个类数组对象 `NodeList`。请写一个函数，它接收一个 CSS 选择器，然后返回一个选择到的 DOM 节点数组。\n+2.  请写一个函数，它接收一个由键值对组成的数组，然后将这些键值对设置到 this 关键词指向的对象上，最后将该对象返回。如果 this 是 `null` 或 `undefined`，那就新建一个 `object`。示例：`set.call( {name: \"jay\"}, {age: 10, email: '[[email protected]](/cdn-cgi/l/email-protection)'}); // return {name: \"jay\", age: 10, email: '[[email protected]](/cdn-cgi/l/email-protection)'}`。\n \n-## JavaScript this and apply\n+## JavaScript this 和 apply\n \n-The apply is the array accepting version of call. Therefore, when using `apply`, think of arrays.\n+apply 就是接受数组版本的 call。于是当使用 `apply` 时，多联想下数组。\n \n-> Apply a method to a list.\n+> 将一个方法应用（apply）到一个数组上。\n \n-That is how I remember it and it has helped. Apply adds another plethora of possibilities to your already stacked arsenal of tools as you will soon come to see.\n+我用这句话来记住它，而且还挺管用。apply 为你的现有堆积的军火库又添加了一样利器，增加了很多新的可能，你很快就能体会到这一点。\n \n-When working with a dynamic list of arguments, use apply. Converting a set of data into an array and using apply can allow you to create some powerful and flexible functions that will make your life a lot easier.\n+当你要处理参数数量动态变化的场景，用 apply 吧。将一系列数据转化为数组并用上 apply 能让你写出更好用和更具弹性的代码，会让你的工作更轻松。\n \n-### How to use apply\n+### 如何使用 apply\n \n-[Math.min](https://www.w3schools.com/jsref/jsref_min.asp) and `max` are functions that accept n number of arguments and returns the max and min respectively. Instead of passing in n arguments, you can put n arguments into an array and pass it into min using `apply`.\n+[Math.min](https://www.w3schools.com/jsref/jsref_min.asp) 和 `max` 都是可以接受多个参数并返回最小值和最大值的函数。除了直接传 n 个参数，你也可以将这 n 个参数放到一个数组里然后借助 `apply` 将它传到 min 函数里。\n \n ```\n-Math.min(1,2,3,4); // returns 1\n-Math.min([1,2,3,4]); // returns NaN. Only accepts numbers. \n-Math.min.apply(null, [1,2,3,4]); // returns 1\n+Math.min(1,2,3,4); // 返回 1\n+Math.min([1,2,3,4]); // 返回 NaN。只接受数字\n+Math.min.apply(null, [1,2,3,4]); // 返回 1\n ```\n \n-Did that bend your mind? If so, allow me to explain. By using apply, we are passing in an array, since it accepts an array as the second arguments. What\n+看晕了吗？如果真晕了，那我来解释下。使用 apply 时我们要传一个数组因为它需要数组作为第二个参数。而下面\n \n ```\n-Math.min.apply(null, [1,2,3,4]); // returns 1\n+Math.min.apply(null, [1,2,3,4]); // 返回 1\n ```\n \n-is doing is essentially the following\n+做的事情基本等同于\n \n-`Math.min(1,2,3,4); // returns 1\n+`Math.min(1,2,3,4); // 返回 1\n `\n \n-That is the magic of apply and what i wanted to point out. It works the same way as `call`, but instead of n arguments, we are just passing in an array. Fantastic right? Wait, does that mean `Math.min.call(null, 1,2,3,4);` works the same way as `Math.min.apply(null, [1,2,3,4]);`?\n+这就是我想指出来的 apply 的神奇之处。它和 `call` 工作原理，不过我们只要传给它一个数组而不是 n 个参数。很好玩对吧？桥豆麻袋，这是否意味着 `Math.min.call(null, 1,2,3,4);` 执行起来和 `Math.min.apply(null, [1,2,3,4]);` 一样？\n \n-Yep, you bet! You are now starting to get the hang of it 🙂\n+啊，你说对了！看来你已经开始掌握它了 🙂\n \n-Let’s look at another application.\n+让我们来看下另一种用法。\n \n ```\n function logArgs() {\n-console.log.apply(console, arguments);\n+    console.log.apply(console, arguments);\n }\n logArgs(1,3,'I am a string', {name: \"jay\", age: \"1337\"}, [4,5,6,7]);\n ```\n \n-Yep, you can even pass in array like objects as the second argument to `apply`. Cool right?\n+没错，你甚至可以传一个类数组对象作为 `apply` 的第二个参数。很酷对吧？\n \n-### Exercises\n+### 练习\n \n-1.  Create a function that accepts an array of key value pairs and sets the value to the item that this keyword is pointing at and return that object. If this is `null` or `undefined`, create a new `object`. E.g. `set.apply( {name: \"jay\"}, [{age: 10}]); // return {name: \"jay\", age: 10}`\n-2.  Create a function similar to `Math.max` and `min`, but one one that applies calculations. The first two arguments should be `numbers`. Make sure to convert the arguments after the second into an **array of functions.** A sample template to get started with is provided below\n+1.  写一个函数，它接受一个由键值对组成的数组，然后将这些键值对设置到 this 关键词指向的对象上，最后将该对象返回。如果 this 是 `null` 或 `undefined`，那就新建一个 `object`。示例：`set.apply( {name: \"jay\"}, [{age: 10}]); // 返回 {name: \"jay\", age: 10}`\n+2.  写一个类似 `Math.max` 和 `min` 的函数，不过接收的不是数字而是运算。前两个参数必须是`数字`，而后面的参数你要将其转化为一个**函数数组**。下面提供一个方便你上手理解的示例：\n \n ```\n function operate() {\n-if (arguments.length < 3) {\n-throw new Error(\"Must have at least three arguments\");\n-}\n-if (typeof arguments[0] !== 'number' || typeof arguments[1] !== 'number') {\n-throw new Error(\"first two arguments supplied must be a number\");\n-}\n-// Write code ...\n-// An array of functions. Hint use either call, apply or bind. Don't iterate over arguments and place functions in new array.\n-var args;\n-var result = 0;\n-// Good luck\n+    if (arguments.length < 3) {\n+        throw new Error(\"至少要三个参数\");\n+    }\n+    if (typeof arguments[0] !== 'number' || typeof arguments[1] !== 'number') {\n+        throw new Error(\"前两个参数必须是数字\");\n+    }\n+    // 写代码\n+    // 这是一个由函数组成的数组。你可以用 call、apply 或者 bind。但不要直接遍历参数然后直接塞到一个数组里\n+    var args;\n+    var result = 0;\n+    // 好了，开始吧，祝好运\n }\n function sum(a, b) {\n-return a + b;\n+    return a + b;\n }\n function multiply(a,b) {\n-return a * b;\n+    return a * b;\n }\n-console.log(operate(10, 2, sum, multiply));    // must return 32 -> (10 + 2) + (10 * 2) = 32\n+console.log(operate(10, 2, sum, multiply));    // 必须返回 32 -> (10 + 2) + (10 * 2) = 32\n ```\n \n-## Additional Resource and Readings\n+## 其他文章和资料\n \n-In case my explanations did not make sense to you, below are some additional resources that will help you understand how bind works in JavaScript.\n+假如我上面的解释没能让你释疑，那下面这些额外的资料可以帮你更好地理解 bind 在 JavaScript 里面是怎么运作的。\n \n-*   [Understanding JavaScript function bind prototype](https://www.smashingmagazine.com/2014/01/understanding-javascript-function-prototype-bind/)\n-*   [Stackoverflow – Use of the JavaScript bind method](https://stackoverflow.com/questions/2236747/use-of-the-javascript-bind-method)\n-*   [How-to: call() , apply() and bind() in JavaScript](https://www.codementor.io/niladrisekhardutta/how-to-call-apply-and-bind-in-javascript-8i1jca6jp)\n-*   [JavaScript .call() .apply() and .bind() — explained to a total noob](https://medium.com/@owenyangg/javascript-call-apply-and-bind-explained-to-a-total-noob-63f146684564)\n+*   [理解 JavaScript 函数原型的 bind 方法](https://www.smashingmagazine.com/2014/01/understanding-javascript-function-prototype-bind/)","path":"TODO1/mastering-javascript-this-keyword-detailed-guide.md","position":950,"original_position":950,"commit_id":"a8823fc9d989375e763d56f8095664b14400f75c","original_commit_id":"a8823fc9d989375e763d56f8095664b14400f75c","user":{"login":"dazhi1011","id":6016419,"avatar_url":"https://avatars3.githubusercontent.com/u/6016419?v=4","gravatar_id":"","url":"https://api.github.com/users/dazhi1011","html_url":"https://github.com/dazhi1011","followers_url":"https://api.github.com/users/dazhi1011/followers","following_url":"https://api.github.com/users/dazhi1011/following{/other_user}","gists_url":"https://api.github.com/users/dazhi1011/gists{/gist_id}","starred_url":"https://api.github.com/users/dazhi1011/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dazhi1011/subscriptions","organizations_url":"https://api.github.com/users/dazhi1011/orgs","repos_url":"https://api.github.com/users/dazhi1011/repos","events_url":"https://api.github.com/users/dazhi1011/events{/privacy}","received_events_url":"https://api.github.com/users/dazhi1011/received_events","type":"User","site_admin":false},"body":"原型的 bind 方法 => bind 的原型方法","created_at":"2018-05-02T03:01:31Z","updated_at":"2018-05-02T03:07:04Z","html_url":"https://github.com/xitu/gold-miner/pull/3715#discussion_r185384085","pull_request_url":"https://api.github.com/repos/xitu/gold-miner/pulls/3715","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/comments/185384085"},"html":{"href":"https://github.com/xitu/gold-miner/pull/3715#discussion_r185384085"},"pull_request":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/3715"}}},"pull_request":{"url":"https://api.github.com/repos/xitu/gold-miner/pulls/3715","id":184400196,"html_url":"https://github.com/xitu/gold-miner/pull/3715","diff_url":"https://github.com/xitu/gold-miner/pull/3715.diff","patch_url":"https://github.com/xitu/gold-miner/pull/3715.patch","issue_url":"https://api.github.com/repos/xitu/gold-miner/issues/3715","number":3715,"state":"open","locked":false,"title":"深入浅出 JavaScript 关键词 — this","user":{"login":"weberpan","id":1701394,"avatar_url":"https://avatars1.githubusercontent.com/u/1701394?v=4","gravatar_id":"","url":"https://api.github.com/users/weberpan","html_url":"https://github.com/weberpan","followers_url":"https://api.github.com/users/weberpan/followers","following_url":"https://api.github.com/users/weberpan/following{/other_user}","gists_url":"https://api.github.com/users/weberpan/gists{/gist_id}","starred_url":"https://api.github.com/users/weberpan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weberpan/subscriptions","organizations_url":"https://api.github.com/users/weberpan/orgs","repos_url":"https://api.github.com/users/weberpan/repos","events_url":"https://api.github.com/users/weberpan/events{/privacy}","received_events_url":"https://api.github.com/users/weberpan/received_events","type":"User","site_admin":false},"body":"译文翻译完成，resolve #3501 \r\n","created_at":"2018-04-26T16:42:57Z","updated_at":"2018-05-02T03:07:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55d6b5ab687b9d894a27c93620a8a7d211bffdf4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":514335594,"url":"https://api.github.com/repos/xitu/gold-miner/labels/%E5%89%8D%E7%AB%AF","name":"前端","color":"1d76db","default":false},{"id":322084033,"url":"https://api.github.com/repos/xitu/gold-miner/labels/%E6%AD%A3%E5%9C%A8%E6%A0%A1%E5%AF%B9","name":"正在校对","color":"c2e0c6","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/xitu/gold-miner/pulls/3715/commits","review_comments_url":"https://api.github.com/repos/xitu/gold-miner/pulls/3715/comments","review_comment_url":"https://api.github.com/repos/xitu/gold-miner/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xitu/gold-miner/issues/3715/comments","statuses_url":"https://api.github.com/repos/xitu/gold-miner/statuses/a8823fc9d989375e763d56f8095664b14400f75c","head":{"label":"weberpan:translation/mastering-javascript-this-keyword-detailed-guide.md","ref":"translation/mastering-javascript-this-keyword-detailed-guide.md","sha":"a8823fc9d989375e763d56f8095664b14400f75c","user":{"login":"weberpan","id":1701394,"avatar_url":"https://avatars1.githubusercontent.com/u/1701394?v=4","gravatar_id":"","url":"https://api.github.com/users/weberpan","html_url":"https://github.com/weberpan","followers_url":"https://api.github.com/users/weberpan/followers","following_url":"https://api.github.com/users/weberpan/following{/other_user}","gists_url":"https://api.github.com/users/weberpan/gists{/gist_id}","starred_url":"https://api.github.com/users/weberpan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weberpan/subscriptions","organizations_url":"https://api.github.com/users/weberpan/orgs","repos_url":"https://api.github.com/users/weberpan/repos","events_url":"https://api.github.com/users/weberpan/events{/privacy}","received_events_url":"https://api.github.com/users/weberpan/received_events","type":"User","site_admin":false},"repo":{"id":122219545,"name":"gold-miner","full_name":"weberpan/gold-miner","owner":{"login":"weberpan","id":1701394,"avatar_url":"https://avatars1.githubusercontent.com/u/1701394?v=4","gravatar_id":"","url":"https://api.github.com/users/weberpan","html_url":"https://github.com/weberpan","followers_url":"https://api.github.com/users/weberpan/followers","following_url":"https://api.github.com/users/weberpan/following{/other_user}","gists_url":"https://api.github.com/users/weberpan/gists{/gist_id}","starred_url":"https://api.github.com/users/weberpan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weberpan/subscriptions","organizations_url":"https://api.github.com/users/weberpan/orgs","repos_url":"https://api.github.com/users/weberpan/repos","events_url":"https://api.github.com/users/weberpan/events{/privacy}","received_events_url":"https://api.github.com/users/weberpan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/weberpan/gold-miner","description":"🥇掘金翻译计划，可能是世界最大最好的英译中技术社区，最懂读者和译者的翻译平台：","fork":true,"url":"https://api.github.com/repos/weberpan/gold-miner","forks_url":"https://api.github.com/repos/weberpan/gold-miner/forks","keys_url":"https://api.github.com/repos/weberpan/gold-miner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/weberpan/gold-miner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/weberpan/gold-miner/teams","hooks_url":"https://api.github.com/repos/weberpan/gold-miner/hooks","issue_events_url":"https://api.github.com/repos/weberpan/gold-miner/issues/events{/number}","events_url":"https://api.github.com/repos/weberpan/gold-miner/events","assignees_url":"https://api.github.com/repos/weberpan/gold-miner/assignees{/user}","branches_url":"https://api.github.com/repos/weberpan/gold-miner/branches{/branch}","tags_url":"https://api.github.com/repos/weberpan/gold-miner/tags","blobs_url":"https://api.github.com/repos/weberpan/gold-miner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/weberpan/gold-miner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/weberpan/gold-miner/git/refs{/sha}","trees_url":"https://api.github.com/repos/weberpan/gold-miner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/weberpan/gold-miner/statuses/{sha}","languages_url":"https://api.github.com/repos/weberpan/gold-miner/languages","stargazers_url":"https://api.github.com/repos/weberpan/gold-miner/stargazers","contributors_url":"https://api.github.com/repos/weberpan/gold-miner/contributors","subscribers_url":"https://api.github.com/repos/weberpan/gold-miner/subscribers","subscription_url":"https://api.github.com/repos/weberpan/gold-miner/subscription","commits_url":"https://api.github.com/repos/weberpan/gold-miner/commits{/sha}","git_commits_url":"https://api.github.com/repos/weberpan/gold-miner/git/commits{/sha}","comments_url":"https://api.github.com/repos/weberpan/gold-miner/comments{/number}","issue_comment_url":"https://api.github.com/repos/weberpan/gold-miner/issues/comments{/number}","contents_url":"https://api.github.com/repos/weberpan/gold-miner/contents/{+path}","compare_url":"https://api.github.com/repos/weberpan/gold-miner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/weberpan/gold-miner/merges","archive_url":"https://api.github.com/repos/weberpan/gold-miner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/weberpan/gold-miner/downloads","issues_url":"https://api.github.com/repos/weberpan/gold-miner/issues{/number}","pulls_url":"https://api.github.com/repos/weberpan/gold-miner/pulls{/number}","milestones_url":"https://api.github.com/repos/weberpan/gold-miner/milestones{/number}","notifications_url":"https://api.github.com/repos/weberpan/gold-miner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/weberpan/gold-miner/labels{/name}","releases_url":"https://api.github.com/repos/weberpan/gold-miner/releases{/id}","deployments_url":"https://api.github.com/repos/weberpan/gold-miner/deployments","created_at":"2018-02-20T15:51:38Z","updated_at":"2018-03-26T06:00:33Z","pushed_at":"2018-05-01T01:53:34Z","git_url":"git://github.com/weberpan/gold-miner.git","ssh_url":"git@github.com:weberpan/gold-miner.git","clone_url":"https://github.com/weberpan/gold-miner.git","svn_url":"https://github.com/weberpan/gold-miner","homepage":"https://juejin.im/tag/掘金翻译计划","size":30939,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"xitu:master","ref":"master","sha":"14d3e518b6379faf636eac0ef912a682b6c90874","user":{"login":"xitu","id":10482599,"avatar_url":"https://avatars2.githubusercontent.com/u/10482599?v=4","gravatar_id":"","url":"https://api.github.com/users/xitu","html_url":"https://github.com/xitu","followers_url":"https://api.github.com/users/xitu/followers","following_url":"https://api.github.com/users/xitu/following{/other_user}","gists_url":"https://api.github.com/users/xitu/gists{/gist_id}","starred_url":"https://api.github.com/users/xitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitu/subscriptions","organizations_url":"https://api.github.com/users/xitu/orgs","repos_url":"https://api.github.com/users/xitu/repos","events_url":"https://api.github.com/users/xitu/events{/privacy}","received_events_url":"https://api.github.com/users/xitu/received_events","type":"Organization","site_admin":false},"repo":{"id":45512989,"name":"gold-miner","full_name":"xitu/gold-miner","owner":{"login":"xitu","id":10482599,"avatar_url":"https://avatars2.githubusercontent.com/u/10482599?v=4","gravatar_id":"","url":"https://api.github.com/users/xitu","html_url":"https://github.com/xitu","followers_url":"https://api.github.com/users/xitu/followers","following_url":"https://api.github.com/users/xitu/following{/other_user}","gists_url":"https://api.github.com/users/xitu/gists{/gist_id}","starred_url":"https://api.github.com/users/xitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitu/subscriptions","organizations_url":"https://api.github.com/users/xitu/orgs","repos_url":"https://api.github.com/users/xitu/repos","events_url":"https://api.github.com/users/xitu/events{/privacy}","received_events_url":"https://api.github.com/users/xitu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xitu/gold-miner","description":"🥇掘金翻译计划，可能是世界最大最好的英译中技术社区，最懂读者和译者的翻译平台：","fork":false,"url":"https://api.github.com/repos/xitu/gold-miner","forks_url":"https://api.github.com/repos/xitu/gold-miner/forks","keys_url":"https://api.github.com/repos/xitu/gold-miner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xitu/gold-miner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xitu/gold-miner/teams","hooks_url":"https://api.github.com/repos/xitu/gold-miner/hooks","issue_events_url":"https://api.github.com/repos/xitu/gold-miner/issues/events{/number}","events_url":"https://api.github.com/repos/xitu/gold-miner/events","assignees_url":"https://api.github.com/repos/xitu/gold-miner/assignees{/user}","branches_url":"https://api.github.com/repos/xitu/gold-miner/branches{/branch}","tags_url":"https://api.github.com/repos/xitu/gold-miner/tags","blobs_url":"https://api.github.com/repos/xitu/gold-miner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xitu/gold-miner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xitu/gold-miner/git/refs{/sha}","trees_url":"https://api.github.com/repos/xitu/gold-miner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xitu/gold-miner/statuses/{sha}","languages_url":"https://api.github.com/repos/xitu/gold-miner/languages","stargazers_url":"https://api.github.com/repos/xitu/gold-miner/stargazers","contributors_url":"https://api.github.com/repos/xitu/gold-miner/contributors","subscribers_url":"https://api.github.com/repos/xitu/gold-miner/subscribers","subscription_url":"https://api.github.com/repos/xitu/gold-miner/subscription","commits_url":"https://api.github.com/repos/xitu/gold-miner/commits{/sha}","git_commits_url":"https://api.github.com/repos/xitu/gold-miner/git/commits{/sha}","comments_url":"https://api.github.com/repos/xitu/gold-miner/comments{/number}","issue_comment_url":"https://api.github.com/repos/xitu/gold-miner/issues/comments{/number}","contents_url":"https://api.github.com/repos/xitu/gold-miner/contents/{+path}","compare_url":"https://api.github.com/repos/xitu/gold-miner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xitu/gold-miner/merges","archive_url":"https://api.github.com/repos/xitu/gold-miner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xitu/gold-miner/downloads","issues_url":"https://api.github.com/repos/xitu/gold-miner/issues{/number}","pulls_url":"https://api.github.com/repos/xitu/gold-miner/pulls{/number}","milestones_url":"https://api.github.com/repos/xitu/gold-miner/milestones{/number}","notifications_url":"https://api.github.com/repos/xitu/gold-miner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xitu/gold-miner/labels{/name}","releases_url":"https://api.github.com/repos/xitu/gold-miner/releases{/id}","deployments_url":"https://api.github.com/repos/xitu/gold-miner/deployments","created_at":"2015-11-04T03:29:13Z","updated_at":"2018-05-02T03:07:01Z","pushed_at":"2018-05-02T02:32:15Z","git_url":"git://github.com/xitu/gold-miner.git","ssh_url":"git@github.com:xitu/gold-miner.git","clone_url":"https://github.com/xitu/gold-miner.git","svn_url":"https://github.com/xitu/gold-miner","homepage":"https://juejin.im/tag/掘金翻译计划","size":32552,"stargazers_count":13470,"watchers_count":13470,"language":null,"has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2388,"mirror_url":null,"archived":false,"open_issues_count":39,"license":null,"forks":2388,"open_issues":39,"watchers":13470,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/3715"},"html":{"href":"https://github.com/xitu/gold-miner/pull/3715"},"issue":{"href":"https://api.github.com/repos/xitu/gold-miner/issues/3715"},"comments":{"href":"https://api.github.com/repos/xitu/gold-miner/issues/3715/comments"},"review_comments":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/3715/comments"},"review_comment":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xitu/gold-miner/pulls/3715/commits"},"statuses":{"href":"https://api.github.com/repos/xitu/gold-miner/statuses/a8823fc9d989375e763d56f8095664b14400f75c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dazhi1011"}}