Skip to content
Closed
Changes from all commits
Commits
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
46 changes: 43 additions & 3 deletions starter-code/basic-algorithms.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,47 @@
// Names and Input
// Names and Input* cambios

var hacker1 = "Jesús"
console.log("The river´s name is" + hacker1);

//Conditionals
var hacker2 = prompt ("What´s your name?");
console.log("The navigator´s name is + hacker2");


// Lorem ipsum generator

//Conditionals*

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("Navigator has the longest name, it has" + "" + hacker2.length + "" + "characters")
}else{
console.log("Wow!!, you both got equally long names," + "" + hacker2.length + "" + "characters")
}


// Loops*

var pack = "";
for (var i = 0; i < hacker2.length; i++) {
+= hacker2[i].toUpperCase() + "";
}
console.log(pack)


var hacker2Reverse = "";
for (var i = hacker2.length -1; i >= 0; i --) {
hacker2Reverse += hacker2[i];
}
console.log(hacker2Reverse);

if (hacker1 < hacker2) {
console.log("The Driver´s name goes first");
}else if (hacker1 > hacker2) {
console.log("Yo, the navigator goes first definitely")
}else {
console.log("What?! You both got the same name?");



}
hola