Movatterモバイル変換


[0]ホーム

URL:


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

Basic operators, maths#314

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
15 commits
Select commitHold shift + click to select a range
5b36995
traducción completa de 08 operators
EzequielCasteJul 22, 2020
7d34563
Update 1-js/02-first-steps/08-operators/1-increment-order/solution.md
EzequielCasteJul 22, 2020
a11a915
Update 1-js/02-first-steps/08-operators/1-increment-order/solution.md
EzequielCasteJul 22, 2020
500d8e5
Update 1-js/02-first-steps/08-operators/1-increment-order/task.md
EzequielCasteJul 22, 2020
b14e252
Update 1-js/02-first-steps/08-operators/3-primitive-conversions-quest…
EzequielCasteJul 22, 2020
ef70003
Update 1-js/02-first-steps/08-operators/3-primitive-conversions-quest…
EzequielCasteJul 22, 2020
0b01e8b
Update 1-js/02-first-steps/08-operators/article.md
EzequielCasteJul 22, 2020
3fb8d40
Update 1-js/02-first-steps/08-operators/article.md
EzequielCasteJul 22, 2020
5a008f3
Update 1-js/02-first-steps/08-operators/article.md
EzequielCasteJul 22, 2020
01716b7
Update 1-js/02-first-steps/08-operators/article.md
EzequielCasteJul 22, 2020
470f5f8
Update 1-js/02-first-steps/08-operators/article.md
EzequielCasteJul 22, 2020
4104623
Update 1-js/02-first-steps/08-operators/article.md
EzequielCasteJul 23, 2020
fa1f7d2
Update 1-js/02-first-steps/08-operators/1-increment-order/solution.md
EzequielCasteJul 23, 2020
b83d4b1
Update 1-js/02-first-steps/08-operators/1-increment-order/solution.md
EzequielCasteJul 23, 2020
ec1088a
Update 1-js/02-first-steps/08-operators/3-primitive-conversions-quest…
EzequielCasteJul 23, 2020
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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@

The answer is:
La respuesta es:

- `a = 2`
- `b = 2`
Expand All@@ -9,10 +9,9 @@ The answer is:
```js run no-beautify
let a = 1, b = 1;

alert( ++a ); // 2,prefix form returns the new value
alert( b++ ); // 1,postfix form returns the old value
alert( ++a ); // 2,la forma de prefijo devuelve el nuevo valor
alert( b++ ); // 1,la forma de sufijo devuelve el antiguo valor

alert( a ); // 2,incremented once
alert( b ); // 2,incremented once
alert( a ); // 2,incrementado una vez
alert( b ); // 2,incrementado una vez
```

View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,9 +2,9 @@ importance: 5

---

#The postfix and prefix forms
#Las formas sufijo y prefijo

What are the final values of allvariables `a`, `b`, `c`and `d`after the code below?
¿Cuáles son los valores finales de todas lasvariables `a`, `b`, `c`y `d`después del código a continuación?

```js
let a = 1, b = 1;
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
The answer is:
La respuesta es:

- `a = 4` (multiplied by 2)
- `x = 5` (calculated as 1 + 4)
- `a = 4` (multiplicado por 2)
- `x = 5` (calculado como 1 + 4)

View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,9 +2,9 @@ importance: 3

---

#Assignment result
#Resultado de asignación

What are the values of `a` and `x` after the code below?
¿Cuáles son los valores de 'a' y 'x' después del código a continuación?

```js
let a = 2;
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,10 +17,10 @@ undefined + 1 = NaN // (6)
" \t \n" - 2 = -2 // (7)
```

1.The addition with a string `"" + 1`converts `1`to astring: `"" + 1 = "1"`,and then we have`"1" + 0`,the same rule is applied.
2.The subtraction `-` (like most math operations) only works with numbers, it converts an empty string`""`to `0`.
3.The addition with a string appends the number `5`to the string.
4.The subtraction always converts to numbers, so it makes`" -9 "`a number `-9` (ignoring spaces around it).
5. `null`becomes`0`after the numeric conversion.
6. `undefined`becomes`NaN`after the numeric conversion.
7.Space characters, are trimmed off string start and end when a string is converted to a number. Here the whole string consists of space characters, such as `\t`, `\n`and a "regular" space between them. So, similarly to an empty string, it becomes `0`.
1.La suma con una cadena `"" + 1`convierte `1`a unstring: `"" + 1 = "1"`,y luego tenemos`"1" + 0`,la misma regla se aplica.
2.La resta `-` (como la mayoría de las operaciones matemáticas) sólo funciona con números, convierte una cadena vacía`""`a `0`.
3.La suma con una cadena concatena el número `5`a la cadena.
4.La resta siempre convierte a números, por lo tanto hace de`" -9 "`un número `-9` (ignorando los espacios que lo rodean).
5. `null`se convierte en`0`después de la conversión numérica.
6. `undefined`se convierte en`NaN`después de la conversión numérica.
7.Los caracteres de espacio se recortan al inicio y al final de la cadena cuando una cadena se convierte en un número. Aquí toda la cadena consiste en caracteres de espacio, tales como `\t`, `\n`y un espacio "común" entre ellos. Por lo tanto, pasa lo mismo que a una cadena vacía, se convierte en `0`.
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@ importance: 5

---

# Conversiones deTipos
# Conversiones detipos

¿Cuáles son los resultados de estas expresiones?

Expand All@@ -24,4 +24,4 @@ undefined + 1
" \t \n" - 2
```

Piensacuidadosamente, luego escribe los resultados y compáralos con la respuesta.
Piensabien, anótalos y luego compara con la respuesta.
24 changes: 12 additions & 12 deletions1-js/02-first-steps/08-operators/4-fix-prompt/solution.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
The reason is that prompt returns user input as a string.
La razón es que la captura devuelve la entrada del usuario como una cadena.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
La razón es que la captura devuelvela entrada del usuario como una cadena.
La razón es que la captura devuelvelo que ingresa el usuario como una cadena.

Don makumi me convenció que ingresso es mas cool
estoy de acuerdo
aunque también te cambié el armado...


Sovariableshave values `"1"`and `"2"`respectively.
Entonces lasvariablestienen valores `"1"`y `"2"`respectivamente.

```js run
let a = "1"; // prompt("First number?", 1);
let b = "2"; // prompt("Second number?", 2);
let a = "1"; // prompt("Primer número?", 1);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let a = "1"; // prompt("Primer número?", 1);
let a = "1"; // prompt("¿Primer número?", 1);

No me gusta la pregunta pero eso no es importante. PEro la apertura para cumplir con la RAE.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
let a = "1"; // prompt("Primer número?", 1);
let a = "1"; // prompt("Primer número", 1);

Yo opino que va sin signo interrogativo pues no es una pregunta la que se hace, sino una solicitud

Copy link
Member

Choose a reason for hiding this comment

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

¿No pedís con una pregunta?

o así:

if (
+prompt( "Dame todo tu dinero", 10000 ) < 5 ;
kickHim();
...

Copy link
Collaborator

Choose a reason for hiding this comment

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

De hecho no... Leelo con tono de pregunta.@joaquinelio

let b = "2"; // prompt("Segundo número?", 2);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let b = "2"; // prompt("Segundo número?", 2);
let b = "2"; // prompt("¿Segundo número?", 2);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
let b = "2"; // prompt("Segundo número?", 2);
let b = "2"; // prompt("Segundo número", 2);

Misma puerca pero revolcada...


alert(a + b); // 12
```

What we should to is to convert strings to numbers before`+`.For example, using `Number()`or prepending them with `+`.
Lo que debemos hacer es convertir las cadenas de texto a números antes`+`.Por ejemplo, utilizando `Number()`o anteponiendo `+`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Lo que debemos hacer es convertir las cadenas de texto a números antes`+`. Por ejemplo, utilizando`Number()` o anteponiendo`+`.
Lo que debemos hacer es convertir las cadenas de texto a números antesdel`+`. Por ejemplo, utilizando`Number()` o anteponiendo`+`.

hubiera aclarado binario + anteponiendo unario +
mal ilya
mentira, distrae.

o ante "+"


For example, right before `prompt`:
Por ejemplo, justo antes de `prompt`:

```js run
let a = +prompt("First number?", 1);
let b = +prompt("Second number?", 2);
let a = +prompt("Primer número?", 1);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let a = +prompt("Primer número?", 1);
let a = +prompt("¿Primer número?", 1);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
let a = +prompt("Primer número?", 1);
let a = +prompt("Primer número", 1);

let b = +prompt("Segundo número?", 2);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let b = +prompt("Segundo número?", 2);
let b = +prompt("¿Segundo número?", 2);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
let b = +prompt("Segundo número?", 2);
let b = +prompt("Segundo número", 2);

Same...


alert(a + b); // 3
```

Or in the `alert`:
O en el `alert`:

```js run
let a = prompt("First number?", 1);
let b = prompt("Second number?", 2);
let a = prompt("Primer número?", 1);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let a = prompt("Primer número?", 1);
let a = prompt("¿Primer número?", 1);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
let a = prompt("Primer número?", 1);
let a = prompt("Primer número", 1);

let b = prompt("Segundo número?", 2);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let b = prompt("Segundo número?", 2);
let b = prompt("¿Segundo número?", 2);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
let b = prompt("Segundo número?", 2);
let b = prompt("Segundo número", 2);

Same...


alert(+a + +b); // 3
```

Using both unary and binary `+`in the latest code. Looks funny, doesn't it?
Usar ambos unario y binario `+`en el último ejemplo, se ve raro no?
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Usar ambos unario y binario`+`en el último ejemplo, se ve rarono?
Usar ambos`+`, elunario yelbinario en el último ejemplo, se ve raro, ¿no?

mejor armada creo
aisla compl con , ,
ah, y apertura ¿

, ¿se ve raro o no? puaj no.

maksumi reacted with thumbs up emoji
12 changes: 6 additions & 6 deletions1-js/02-first-steps/08-operators/4-fix-prompt/task.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,17 +2,17 @@ importance: 5

---

#Fix the addition
#Corregir la adición

Here's a code that asks the user for two numbers and shows their sum.
Aquí hay un código que le pide al usuario dos números y muestra su suma.

It works incorrectly. The output in the example below is`12` (for default prompt values).
Funciona incorrectamente. El resultado en el ejemplo a continuación es`12` (para valores de captura predeterminados).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Funciona incorrectamente. El resultado en el ejemplo a continuación es`12` (para valores de captura predeterminados).
Funciona incorrectamente. El resultado en el ejemplo a continuación es`12` (paralosvalores de captura predeterminados).


Why? Fix it. The result should be `3`.
¿Por qué? Arreglalo. El resultado debería ser `3`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
¿Por qué?Arreglalo. El resultado debería ser`3`.
¿Por qué?Arréglalo. El resultado debería ser`3`.


```js run
let a = prompt("First number?", 1);
let b = prompt("Second number?", 2);
let a = prompt("Primer número?", 1);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let a = prompt("Primer número?", 1);
let a = prompt("¿Primer número?", 1);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
let a = prompt("Primer número?", 1);
let a = prompt("Primer número", 1);

Otro!?!?!?

let b = prompt("Segundo número?", 2);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let b = prompt("Segundo número?", 2);
let b = prompt("¿Segundo número?", 2);

otro??
UFA para qué me meti a corregir esta gilada... jja

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
let b = prompt("Segundo número?", 2);
let b = prompt("Segundo número", 2);

Y otro..

Copy link
Member

Choose a reason for hiding this comment

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

¿HAss VISTO?
Si hubiera sabido que eran tantoss, no me habría metido a "arreglarlos" ni valia la pena


alert(a + b); // 12
```
Loading

[8]ページ先頭

©2009-2025 Movatter.jp