-
Notifications
You must be signed in to change notification settings - Fork 5.9k
MAD PT César Aparicio #53
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,41 @@ | ||
| // Names and Input | ||
| var hacker1 = "Juancho"; | ||
| console.log("The driver's name is " + hacker1); | ||
| var hacker2 = prompt("What's your name navigator"); | ||
| console.log("The navigator name is " + hacker2); | ||
|
|
||
| if (hacker1.length > hacker2.length) { | ||
| console.log("The Driver has the longest name, it has " + hacker1.length + "characters"); | ||
| } | ||
| else if (hacker1.length < hacker2.length) { | ||
| console.log("The navigator got the longest name, it has " + hacker2.length + " characters"); | ||
| } | ||
| else { | ||
| console.log ("wow, you both got equally long names, " + hacker1.length + "characters!!"); | ||
| } | ||
| var UpperCase = ""; | ||
| console.log(hacker1.toUpperCase()); | ||
|
|
||
| //Conditionals | ||
| var UpperCase = ""; | ||
| var splitUpper = UpperCase.split(); | ||
| console.log(splitUpper); | ||
|
|
||
| //¿Por qué es necesario un loop para hacer un reverse? | ||
|
|
||
|
|
||
| var upper = ""; | ||
| for (var i = 0; i < hacker1.lenght; i++) { | ||
| upper += hacker[i].toUppercase(); | ||
| if (i < hacker1.lenght -1) { | ||
|
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. El método length está mal escrito, has puesto lenght y se escribe length |
||
| upper += ""; | ||
| } | ||
| } | ||
| //no entiendo el motivo del += si ya he metido el i++ | ||
| console.log (uppper); | ||
|
|
||
| var upperRev = ""; | ||
|
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. console.log(uppper) Al ejecutar el código la variable no existe. La has escrito con triple letra "p". |
||
| for ( var i = hacker2.lenght -1; i <= 0; i--) { | ||
| upperRev += hacker2[i]; | ||
| } | ||
| console.log(upperRev); | ||
|
|
||
|
|
||
| // Lorem ipsum generator | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Es necesario un loop porque hay que iterar sobre cada una de las letras de la palabra para ponerlas en mayúsculas y guardarlas añadiéndole un espacio a cada una.