Skip to content

Commit 4f72357

Browse files
committed
UPDATE
1 parent 86735b4 commit 4f72357

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

JS/JS-br.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
- [Modularização](#modularização)
2424
- [CommonJS](#commonjs)
2525
- [AMD](#amd)
26-
- [A diferença entre call, apply, bind](#the-differences-between-call-apply-bind)
27-
- [simulação para implementar `call` e `apply`](#simulation-to-implement--call-and--apply)
26+
- [A diferença entre call apply bind](#a-diferença-entre-call-apply-bind)
27+
- [simulação para implementar `call` e `apply`](#simulação-para-implementar--call-e--apply)
2828
- [Implementação de Promise](#promise-implementation)
2929
- [Implementação do Generator](#generator-implementation)
3030
- [Debouncing](#debouncing)
@@ -700,7 +700,7 @@ existem propostas.
700700
701701
## AMD
702702
703-
AMD is brought forward by `RequireJS`.
703+
AMD é apresentado por `RequireJS`.
704704
705705
```js
706706
// AMD
@@ -716,13 +716,13 @@ define(function(require, exports, module) {
716716
})
717717
```
718718
719-
# The differences between call, apply, bind
719+
# A diferença entre call apply bind
720720
721-
Firstly, let’s tell the difference between the former two.
721+
Primeiro, vamos falar a diferença entre os dois antigos.
722722
723-
Both `call` and `apply` are used to change what `this` refers to. Their role is the same, but the way to pass parameters is different.
723+
Ambos `call` e `apply` são usados para mudar o que o `this` se refere. Seu papel é o mesmo, mas a maneira de passar os parâmetros é diferente.
724724
725-
In addition to the first parameter, `call` can accept an argument list, while `apply` accepts a single array of arguments.
725+
Além do primeiro parâmetro, `call` também aceita uma lista de argumentos, enquanto `apply` aceita um único array de argumentos.
726726
727727
```js
728728
let a = {
@@ -737,12 +737,13 @@ getValue.call(a, 'yck', '24')
737737
getValue.apply(a, ['yck', '24'])
738738
```
739739
740-
## simulation to implement `call` and `apply`
740+
## simulação para implementar `call` e `apply`
741741
742-
We can consider how to implement them from the following rules:
742+
Consideramos implementar eles a partir das seguintes regras:
743743
744-
* If the first parameter isn’t passed, then the first parameter will default to `window`;
745-
* Change what `this` refers to, which makes new object capable of executing the function. Then let’s think like this: add a function to a new object and then delete it after the execution.
744+
* Se o primeiro parâmetro não foi passado, então o primeiro será o padrão `window`;
745+
746+
* Mude a referência do `this`, que faz um novo objeto capaz de executar a função. Então vamos pensar assim: adicione a função para um novo objeto e então delete ele depois da execução.
746747
747748
```js
748749
Function.prototype.myCall = function (context) {

0 commit comments

Comments
 (0)