- Notifications
You must be signed in to change notification settings - Fork230
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
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
5b369957d34563a11a915500d8e5b14e252ef700030b01e8b3fb8d405a008f301716b7470f5f84104623fa1f7d2b83d4b1ec1088aFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| La respuesta es: | ||
| - `a = 4` (multiplicado por 2) | ||
| - `x = 5` (calculado como 1 + 4) | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,32 +1,32 @@ | ||||||||||
| La razón es que la captura devuelve la entrada del usuario como una cadena. | ||||||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
Don makumi me convenció que ingresso es mas cool | ||||||||||
| Entonces lasvariablestienen valores`"1"`y`"2"`respectivamente. | ||||||||||
| ```js run | ||||||||||
| let a="1";// prompt("Primer número?", 1); | ||||||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
No me gusta la pregunta pero eso no es importante. PEro la apertura para cumplir con la RAE. Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
Yo opino que va sin signo interrogativo pues no es una pregunta la que se hace, sino una solicitud Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. ¿No pedís con una pregunta? o así: if ( Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||||||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
Misma puerca pero revolcada... | ||||||||||
| alert(a+ b);// 12 | ||||||||||
| ``` | ||||||||||
| Lo que debemos hacer es convertir las cadenas de texto a números antes`+`.Por ejemplo, utilizando`Number()`o anteponiendo`+`. | ||||||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
hubiera aclarado binario + anteponiendo unario + o ante "+" | ||||||||||
| Por ejemplo, justo antes de`prompt`: | ||||||||||
| ```js run | ||||||||||
| let a=+prompt("Primer número?",1); | ||||||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
| ||||||||||
| let b=+prompt("Segundo número?",2); | ||||||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
Same... | ||||||||||
| alert(a+ b);// 3 | ||||||||||
| ``` | ||||||||||
| O en el`alert`: | ||||||||||
| ```js run | ||||||||||
| let a=prompt("Primer número?",1); | ||||||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
| ||||||||||
| let b=prompt("Segundo número?",2); | ||||||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
Same... | ||||||||||
| alert(+a++b);// 3 | ||||||||||
| ``` | ||||||||||
| Usar ambos unario y binario`+`en el último ejemplo, se ve raro no? | ||||||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
mejor armada creo , ¿se ve raro o no? puaj no. | ||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -2,17 +2,17 @@ importance: 5 | ||||||||||
| --- | ||||||||||
| #Corregir la adición | ||||||||||
| Aquí hay un código que le pide al usuario dos números y muestra su suma. | ||||||||||
| Funciona incorrectamente. El resultado en el ejemplo a continuación es`12` (para valores de captura predeterminados). | ||||||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
| ||||||||||
| ¿Por qué? Arreglalo. El resultado debería ser `3`. | ||||||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
| ||||||||||
| ```js run | ||||||||||
| let a = prompt("Primer número?", 1); | ||||||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
Otro!?!?!? | ||||||||||
| let b = prompt("Segundo número?", 2); | ||||||||||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
otro?? Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
Y otro.. Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. ¿HAss VISTO? | ||||||||||
| alert(a + b); // 12 | ||||||||||
| ``` | ||||||||||
Uh oh!
There was an error while loading.Please reload this page.