Skip to content

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

Closed
wants to merge 1 commit into from
Closed

Constructor, operator "new" #88

wants to merge 1 commit into from

Conversation

PedroDousseau
Copy link
Contributor

Article translated

Article translated
@javascript-translate-bot

Error: the article already has PR number in the Progress Issue #1, it's 87 ⁉️

@CLAassistant
Copy link

CLAassistant commented Nov 17, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@odsantos odsantos left a 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "# Crie uma calculadora new Calculator"

@@ -2,24 +2,24 @@ importance: 5

---

# Create new Accumulator
# Crie um acumulador new
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "# Crie um acumulador new 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "// apresenta a soma destses destes 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.
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "...letra em maiúsculo maiúsculas."

};
}

*!*
let john = new User("John");

john.sayHi(); // My name is: John
john.sayHi(); // Meu nome é: John
*/!*

/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


- 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "...letra em maiúsculo maiú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.
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "...muitos objetos internos de da linguagem internos:"
  • ", Set para armazenamento conjuntos 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>.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "...que aprendemos isto aprendermos isso,"

@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants