- Notifications
You must be signed in to change notification settings - Fork230
Logical operators#47
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
tscandalitta merged 36 commits intojavascript-tutorial:masterfromSjesc:logical-operatorsMay 20, 2019
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
36 commits Select commitHold shift + click to select a range
35a6c72 Traducción de Logical Operators
Sjescf1ab3cc Fix small details
Sjesc85b9fcd Translate string
Sjesc865f4e7 fixes
tscandalittaec93c16 fix 2
tscandalittab109d94 fix 3
tscandalitta335ce5f fix 4
tscandalitta0bac3ae fix 5
tscandalittab7f27dc Update solution.md
tscandalitta6d0f0a6 Update task.md
tscandalitta885c3fe Update solution.md
tscandalittae306bae Update task.md
tscandalitta05c8fa6 Update solution.md
tscandalitta1a7bb8a Update task.md
tscandalitta682cda5 Update task.md
tscandalittaa2fac86 Update solution.md
tscandalitta7f940f1 Update task.md
tscandalitta36c1b7d Update solution.md
tscandalitta32b4744 Update task.md
tscandalitta4b8c0a6 Update solution.md
tscandalitta9c17870 Update task.md
tscandalitta847d5f5 Update solution.md
tscandalitta96a65ec Update solution.md
tscandalitta4809cbe Update task.md
tscandalittaf2e80f4 Update task.md
tscandalitta7fa3dd2 Update solution.md
tscandalitta1adc84c Update solution.md
tscandalittac7cb13e Update solution.md
tscandalitta0a5f045 Update solution.md
tscandalitta28c2314 Update article.md
tscandalittaded4ce0 Update task.md
tscandalittaa97d693 Update solution.md
tscandalittae13ff70 Update solution.md
tscandalittabd691f5 Update task.md
tscandalitta1345509 Update solution.md
tscandalitta927cb20 Update task.md
tscandalittaFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion1-js/02-first-steps/11-logical-operators/1-alert-null-2-undefined/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| La respuesta es `2`,ese es el primer valor verdadero. | ||
| ```js run | ||
| alert( null || 2 || undefined ); | ||
4 changes: 2 additions & 2 deletions1-js/02-first-steps/11-logical-operators/1-alert-null-2-undefined/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions1-js/02-first-steps/11-logical-operators/2-alert-or/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| La repuesta: primero `1`,después `2`. | ||
| ```js run | ||
| alert( alert(1) || 2 || alert(3) ); | ||
| ``` | ||
| La llamada a `alert`no retorna un valor. O, en otras palabras, retorna `undefined`. | ||
| 1.El primer OR `||`evalua el operando de la izquierda`alert(1)`.Eso muestra el primer mensaje con `1`. | ||
| 2.El `alert`retorna `undefined`,por lo que OR se dirige al segundo operando buscando un valor verdadero. | ||
| 3.El segundo operando `2`es un valor verdadero, por lo que se detiene la ejecución, se retorna`2`y es mostrado por elalert exterior. | ||
| No habrá`3` debido a que la evaluación no alcanza a `alert(3)`. |
4 changes: 2 additions & 2 deletions1-js/02-first-steps/11-logical-operators/2-alert-or/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion1-js/02-first-steps/11-logical-operators/3-alert-1-null-2/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| La respuesta: `null`,porque es el primer valor falso de la lista. | ||
| ```js run | ||
| alert( 1 && null && 2 ); | ||
4 changes: 2 additions & 2 deletions1-js/02-first-steps/11-logical-operators/3-alert-1-null-2/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions1-js/02-first-steps/11-logical-operators/4-alert-and/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,9 @@ | ||
| La respuesta: `1` y después `undefined`. | ||
| ```js run | ||
| alert( alert(1) && alert(2) ); | ||
| ``` | ||
| La llamada a `alert` retorna `undefined` (solo muestra un mensaje, así que no hay un valor que retornar relevante) | ||
| Debido a ello, `&&` evalua el operando de la izquierda (imprime `1`) e inmediatamente se detiene porque `undefined` es un valor falso. Como `&&` busca un valor falso y lo retorna, terminamos. |
4 changes: 2 additions & 2 deletions1-js/02-first-steps/11-logical-operators/4-alert-and/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions1-js/02-first-steps/11-logical-operators/5-alert-and-or/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,16 @@ | ||
| La respuesta: `3`. | ||
| ```js run | ||
| alert( null || 2 && 3 || 4 ); | ||
| ``` | ||
| La precedencia de AND `&&`es mayor que la de`||`,así que se ejecuta primero. | ||
| El resultado de `2 && 3 = 3`,por lo que la expresión se convierte en: | ||
| ``` | ||
| null || 3 || 4 | ||
| ``` | ||
| Ahora el resultado será el primer valor verdadero: `3`. | ||
4 changes: 2 additions & 2 deletions1-js/02-first-steps/11-logical-operators/5-alert-and-or/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -2,9 +2,9 @@ importance: 5 | ||
| --- | ||
| #El resultado de OR AND OR | ||
| ¿Cuál será el resultado? | ||
| ```js | ||
| alert( null || 2 && 3 || 4 ); | ||
6 changes: 3 additions & 3 deletions1-js/02-first-steps/11-logical-operators/6-check-if-in-range/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions1-js/02-first-steps/11-logical-operators/7-check-if-out-range/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| La primer variante: | ||
| ```js | ||
| if (!(age >= 14 && age <= 90)) | ||
| ``` | ||
| La segunda variante: | ||
| ```js | ||
| if (age < 14 || age > 90) | ||
6 changes: 3 additions & 3 deletions1-js/02-first-steps/11-logical-operators/7-check-if-out-range/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
24 changes: 12 additions & 12 deletions1-js/02-first-steps/11-logical-operators/8-if-question/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,20 @@ | ||
| La respuesta: el primero y el tercero serán ejecutados. | ||
| Detalles: | ||
| ```js run | ||
| //Corre. | ||
| //El resultado de -1 || 0 = -1,valor verdadero | ||
| if (-1 || 0) alert("primero" ); | ||
| //No corre. | ||
| // -1 && 0 = 0,valor falso | ||
| if (-1 && 0) alert("segundo" ); | ||
| //Se ejecuta | ||
| //El operador&&tiene mayor precedencia que || | ||
| //Así que-1 && 1se ejecuta primero, dándonos la cadena: | ||
| // null || -1 && 1 -> null || 1 -> 1 | ||
| if (null || -1 && 1) alert("tercero" ); | ||
| ``` | ||
12 changes: 6 additions & 6 deletions1-js/02-first-steps/11-logical-operators/8-if-question/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
32 changes: 16 additions & 16 deletions1-js/02-first-steps/11-logical-operators/9-check-login/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,25 @@ | ||
| ```js run demo | ||
| let userName = prompt("Quién está ahí?",""); | ||
| if (userName == "Admin") { | ||
| let pass = prompt("Contraseña?", ""); | ||
| if (pass == "TheMaster") { | ||
| alert( "Bienvenido!" ); | ||
| } else if (pass == "" || pass == null) { | ||
| alert( "Cancelado." ); | ||
| } else { | ||
| alert( "Contraseña incorrecta" ); | ||
| } | ||
| } else if (userName == "" || userName == null) { | ||
| alert( "Canceledo" ); | ||
| } else { | ||
| alert( "No te conozco" ); | ||
| } | ||
| ``` | ||
| Nota las sangrías verticales dentro de los bloques`if`. Técnicamente no son necesarias, pero facilitan la lectura del código. |
20 changes: 10 additions & 10 deletions1-js/02-first-steps/11-logical-operators/9-check-login/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.