Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d60e5e8

Browse files
committed
Finished AMD
1 parent 4f72357 commit d60e5e8

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

‎JS/JS-br.md‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -748,29 +748,29 @@ Consideramos implementar eles a partir das seguintes regras:
748748
```js
749749
Function.prototype.myCall = function (context) {
750750
var context = context || window
751-
// Add an property to the `context`
751+
// Adiciona uma propriedade ao `context`
752752
// getValue.call(a, 'yck', '24') => a.fn = getValue
753753
context.fn = this
754-
// take out the rest parameters of `context`
754+
// pega os parâmentros do `context`
755755
var args = [...arguments].slice(1)
756756
// getValue.call(a, 'yck', '24') => a.fn('yck', '24')
757757
var result = context.fn(...args)
758-
// delete fn
758+
// deleta fn
759759
delete context.fn
760760
return result
761761
}
762762
```
763763
764-
The above is the main idea of simulating `call`, and the implementation of `apply` is similar.
764+
O exemplo acima é a idéia central da simulação do `call`, e a implementação do `apply` é similar.
765765
766766
```js
767767
Function.prototype.myApply = function (context) {
768768
var context = context || window
769769
context.fn = this
770770

771771
var result
772-
// There's a need to determine whether to store the second parameter
773-
// If the second parameter exists, spread it
772+
// Existe a necessidade de determinar se guarda o segundo parâmentro
773+
// Se o segundo parâmetro existir, espalhe ele
774774
if (arguments[1]) {
775775
result = context.fn(...arguments[1])
776776
} else {
@@ -782,9 +782,9 @@ Function.prototype.myApply = function (context) {
782782
}
783783
```
784784
785-
The role of `bind` is the same as the other two, except that it returns a function. And we can implement currying with `bind`
785+
A regra do `bind` é a mesma das outras duas, exceto que ela retorna uma função. E nós podemos implementar currying com o `bind`
786786
787-
let’s simulate `bind`:
787+
vamos simular o `bind`:
788788
789789
```js
790790
Function.prototype.myBind = function (context) {
@@ -793,9 +793,9 @@ Function.prototype.myBind = function (context) {
793793
}
794794
var _this = this
795795
var args = [...arguments].slice(1)
796-
// return a function
796+
// retorna uma função
797797
return function F() {
798-
// we can use `new F()` because it returns a function, so we need to determine
798+
// Nós podemos usar `new F()` porque ele retorna uma função, então precisamos determinar
799799
if (this instanceof F) {
800800
return new _this(...args, ...arguments)
801801
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /