Skip to content

Commit cb0982e

Browse files
Merge pull request #231 from vplentinax/Giorgiosaud-conditional-if
Conditional operators: if, '?'
2 parents 8d36bcc + 438d1b9 commit cb0982e

File tree

13 files changed

+131
-135
lines changed

13 files changed

+131
-135
lines changed
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
**Yes, it will.**
1+
**Sí lo hará.**
22

3-
Any string except an empty one (and`"0"`is not empty) becomes `true`in the logical context.
3+
Cualquier string excepto uno vacío (y`"0"`que no es vacío) se convierte en `true`en un contexto lógico.
44

5-
We can run and check:
5+
Podemos ejecutar y verificar:
66

77
```js run
88
if ("0"){
9-
alert( 'Hello' );
9+
alert( 'Hola' );
1010
}
1111
```
12-

‎1-js/02-first-steps/10-ifelse/1-if-zero-string/task.md‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ importance: 5
22

33
---
44

5-
# if (a string with zero)
5+
# if (un string con cero)
66

7-
Will `alert` be shown?
7+
Se mostrará el `alert`?
88

99
```js
1010
if ("0"){
1111
alert( 'Hello' );
1212
}
1313
```
14-

‎1-js/02-first-steps/10-ifelse/2-check-standard/ifelse_task2.svg‎

Lines changed: 8 additions & 8 deletions
Loading

‎1-js/02-first-steps/10-ifelse/2-check-standard/ifelse_task2/index.html‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<script>
66
'use strict';
77

8-
letvalue=prompt('What is the "official" name of JavaScript?','');
8+
letvalue=prompt('¿Cuál es el nombre "oficial" de JavaScript?','');
99

1010
if(value=='ECMAScript'){
11-
alert('Right!');
11+
alert('¡Correcto!');
1212
}else{
13-
alert("You don't know? ECMAScript!");
13+
alert("¿No lo sabes? ¡ECMAScript!");
1414
}
1515
</script>
1616

‎1-js/02-first-steps/10-ifelse/2-check-standard/task.md‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ importance: 2
22

33
---
44

5-
# The name of JavaScript
5+
# El nombre de JavaScript
66

7-
Using the `if..else` construct, write the code which asks: 'What is the "official" name of JavaScript?'
7+
Usando el constructor `if..else`, escribe el código que pregunta: '¿Cuál es el nombre "oficial" de JavaScript?'
88

9-
If the visitor enters "ECMAScript", then output "Right!", otherwise -- output: "Didn't know? ECMAScript!"
9+
Si el visitador escribe "ECMAScript", Entonces muestras "¡Correcto!", de lo contrario -- muestra: "¿No lo sabes? ¡ECMAScript!"
1010

1111
![](ifelse_task2.svg)
1212

1313
[demo src="ifelse_task2"]
14-

‎1-js/02-first-steps/10-ifelse/3-sign/if_sign/index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<script>
77
'use strict';
88

9-
letvalue=prompt('Type a number',0);
9+
letvalue=prompt('Escribe un número',0);
1010

1111
if(value>0){
1212
alert(1);

‎1-js/02-first-steps/10-ifelse/3-sign/solution.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33
```js run
4-
let value =prompt('Type a number', 0);
4+
let value =prompt('Escribe un número', 0);
55

66
if (value >0){
77
alert( 1 );

‎1-js/02-first-steps/10-ifelse/3-sign/task.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ importance: 2
44

55
# Show the sign
66

7-
Using `if..else`, write the code which gets a number via `prompt`and then shows in`alert`:
7+
Usando el constructor `if..else`, escribe un código que obtenga a través de un `prompt`un número y entonces muestre en un`alert`:
88

9-
-`1`, if the value is greater than zero,
10-
-`-1`, if less than zero,
11-
-`0`, if equals zero.
9+
-`1`, si el valor es mayor que cero,
10+
-`-1`, si es menor que cero,
11+
-`0`, si es igual a cero.
1212

13-
In this task we assume that the input is always a number.
13+
En la tarea asumimos que siempre el usuario introduce un número.
1414

1515
[demo src="if_sign"]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

33
```js
4-
result = (a + b <4) ?'Below':'Over';
4+
result = (a + b <4) ?'Debajo':'Encima';
55
```
66

‎1-js/02-first-steps/10-ifelse/5-rewrite-if-question/task.md‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ importance: 5
22

33
---
44

5-
# Rewrite 'if' into '?'
5+
# Reescribe el 'if' como '?'
66

7-
Rewrite this `if`using the ternary operator`'?'`:
7+
Reescriba esta condición `if`usando el operador ternario`'?'`:
88

99
```js
1010
if (a + b <4){
11-
result ='Below';
11+
result ='Debajo';
1212
} else{
13-
result ='Over';
13+
result ='Encima';
1414
}
1515
```
16-

0 commit comments

Comments
(0)