Object methods, "this" by joaquinelio · Pull Request #343 · javascript-tutorial/es.javascript.info · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ importance: 5

---

# Using "this" in object literal
# Usando el "this" en un objeto literal

Here the function `makeUser` returns an object.
Aquí la función `makeUser` devuelve un objeto.

What is the result of accessing its `ref`? Why?
¿Cuál es el resultado de acceder a su `ref`? ¿Por qué?

```js
function makeUser() {
Expand All @@ -18,6 +18,5 @@ function makeUser() {

let user = makeUser();

alert( user.ref.name ); // What's the result?
alert( user.ref.name ); // ¿Cuál es el resultado?
```

12 changes: 6 additions & 6 deletions 1-js/04-object-basics/04-object-methods/7-calculator/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ importance: 5

---

# Create a calculator
# Crea una calculadora

Create an object `calculator` with three methods:
Crea un objeto `calculator` con tres métodos:

- `read()` prompts for two values and saves them as object properties.
- `sum()` returns the sum of saved values.
- `mul()` multiplies saved values and returns the result.
- `read()` pide dos valores y los almacena como propiedadess de objeto.
- `sum()` devuelve la suma de los valores almacenados.
- `mul()` multiplica los valores almacenados y devuelve el resultado.

```js
let calculator = {
// ... your code ...
// ... tu código ...
};

calculator.read();
Expand Down
12 changes: 6 additions & 6 deletions 1-js/04-object-basics/04-object-methods/8-chain-calls/task.md
Loading