Skip to content

Commit 96c2b4c

Browse files
working bindings
1 parent ca74e46 commit 96c2b4c

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

03_functions.md

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ A aplicação mais óbvia das funções é quando queremos definir novos vocabul
2020
Um adulto típico tem por volta de 20.000 palavras em seu vocabulário. Apenas algumas linguagens de programação possuem 20.000 conceitos embutidos, sendo que o vocabulário que se tem disponível tende a ser bem definido e, por isso, menos flexível do que a linguagem usada por humanos. Por isso, normalmente temos que adicionar conceitos do nosso próprio vocabulário para evitar repetição.
2121

2222

23-
## Defining a function
23+
## Definindo Uma Função
2424

2525
{{index "square example", [function, definition], [binding, definition]}}
2626

@@ -66,27 +66,17 @@ console.log(power(2, 10));
6666

6767
{{index "return value", "return keyword", undefined}}
6868

69-
Some functions produce a value, such as `power` and `square`, and some
70-
don't, such as `makeNoise`, whose only result is a ((side effect)). A
71-
`return` statement determines the value the function returns. When
72-
control comes across such a statement, it immediately jumps out of the
73-
current function and gives the returned value to the code that called
74-
the function. A `return` keyword without an expression after it will
75-
cause the function to return `undefined`. Functions that don't have a
76-
`return` statement at all, such as `makeNoise`, similarly return
77-
`undefined`.
69+
Algumas funções produzem um valor, como as funções `power` e `square` acima, e outras não, como no exemplo de `makeNoise`, que produz apenas um “efeito colateral”. A declaração `return` é usada para determinar o valor de retorno da função. Quando o controle de execução interpreta essa declaração, ele sai imediatamente do contexto da função atual e disponibiliza o valor retornado para o código que invocou a função. A palavra-chave `return` sem uma expressão após, irá fazer com que o retorno da função seja `undefined`.
7870

7971
{{index parameter, [function, application], [binding, "from parameter"]}}
8072

81-
Parameters to a function behave like regular bindings, but their
82-
initial values are given by the _caller_ of the function, not the code
83-
in the function itself.
84-
85-
## Bindings and scopes
73+
## Parâmetros e Escopos
8674

8775
{{indexsee "top-level scope", "global scope"}}
8876
{{index "var keyword", "global scope", [binding, global], [binding, "scope of"]}}
8977

78+
Os parâmetros de uma função comportam-se como variáveis regulares. Seu valor inicial é informado por quem invocou a função e não pelo código da função em si.
79+
9080
Each binding has a _((scope))_, which is the part of the program
9181
in which the binding is visible. For bindings defined outside of any
9282
function or block, the scope is the whole program—you can refer to

0 commit comments

Comments
 (0)