-
Notifications
You must be signed in to change notification settings - Fork 114
Constructor, operator "new" #88
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
Conversation
Article translated
Error: the article already has PR number in the Progress Issue #1, it's 87 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Pedro,
A very good translation.
I hope not to give you much trouble with this review.
Please, feel free for giving any suggestions.
Thank you,
Osvaldo.
@@ -2,15 +2,15 @@ importance: 5 | |||
|
|||
--- | |||
|
|||
# Create new Calculator | |||
# Crie uma calculadora new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- "# Crie
uma calculadoranew Calculator"
@@ -2,24 +2,24 @@ importance: 5 | |||
|
|||
--- | |||
|
|||
# Create new Accumulator | |||
# Crie um acumulador new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- "# Crie
um acumuladornew Accumulator"
let accumulator = new Accumulator(1); // valor inicial 1 | ||
accumulator.read(); // adiciona o valor digitado pelo usuário | ||
accumulator.read(); // adiciona o valor digitado pelo usuário | ||
alert(accumulator.value); // apresenta a soma destses valores |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- "// apresenta a soma
destsesdestes valores"
|
||
The regular `{...}` syntax allows to create one object. But often we need to create many similar objects, like multiple users or menu items and so on. | ||
A sintaxe regular `{...}` permite criar um objeto. Mas frequentemente precisamos criar vários objetos iguais, como diversos usuários, itens de um menu, etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- "...precisamos de criar vários objetos..."
|
||
1. They are named with capital letter first. | ||
2. They should be executed only with `"new"` operator. | ||
1. Elas são nomeadas com a primeira letra em maiúsculo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- "...letra em
maiúsculomaiúsculas."
}; | ||
} | ||
|
||
*!* | ||
let john = new User("John"); | ||
|
||
john.sayHi(); // My name is: John | ||
john.sayHi(); // Meu nome é: John | ||
*/!* | ||
|
||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- missing code: available at Methods in constructor
|
||
- Constructor functions or, briefly, constructors, are regular functions, but there's a common agreement to name them with capital letter first. | ||
- Constructor functions should only be called using `new`. Such a call implies a creation of empty `this` at the start and returning the populated one at the end. | ||
- Funções construtoras ou, resumidamente, construtores, são funções regulares, mas existe um acordo comum para nomeá-las com a primeira letra em maiúsculo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- "...letra em
maiúsculomaiúsculas ."
- Constructor functions or, briefly, constructors, are regular functions, but there's a common agreement to name them with capital letter first. | ||
- Constructor functions should only be called using `new`. Such a call implies a creation of empty `this` at the start and returning the populated one at the end. | ||
- Funções construtoras ou, resumidamente, construtores, são funções regulares, mas existe um acordo comum para nomeá-las com a primeira letra em maiúsculo. | ||
- Funções construtoras deveriam ser chamadas apenas usando `new`. Tal chamada implica a criação de um `this` vazio no começo e retornando o completo ao final. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"...no começo e o retornando -o- completo ao final."
|
||
JavaScript provides constructor functions for many built-in language objects: like `Date` for dates, `Set` for sets and others that we plan to study. | ||
JavaScript fornece funções construtoras para muitos objetos de linguagem internos: como `Date` para datas, `Set` para armazenamento e outros que nós planejamos estudar. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- "...muitos objetos internos
deda linguageminternos:" - ",
Set
paraarmazenamentoconjuntos e outros..."
('Set' in Algebra)
|
||
After we learn that, we return to objects and cover them in-depth in the chapters <info:prototypes> and <info:classes>. | ||
Depois que aprendemos isto, nós voltamos para os objetos e os cobrimos a fundo nos capítulos <info:prototypes> e <info:classes>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- "...que
aprendemos istoaprendermos isso,"
Please make the requested changes. After it, add a comment "/done". |
Article translated