Skip to content
Closed
Show file tree
Hide file tree
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
Empty file added index.html
Empty file.
26 changes: 25 additions & 1 deletion js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,28 @@
// Iteration 2: Conditionals


// Iteration 3: Loops
// Iteration 3: Loops
console.log("I'm ready");

let hacker1 = 'Hugo';
console.log(`The driver's name is ${hacker1}`);
let hacker2 = 'Someone';
console.log(`The navigator's name is ${hacker2}`);

//trying to find the largest .lenght

let hacker1Length = hacker1.length
let hacker2Length = hacker2.length

if(hacker1Length > hacker2Length){
console.log("The driver has the longest name, it has " + hacker1.length + " characters.")
}else if(hacker2Length > hacker1Length){
console.log("It seems that the navigator has the longest name, it has " + hacker2.length + " characters.")
}else{
console.log("Wow, you both have equally long names, " +hacker1.length + " characters!.")
}

/*Iteration 3: Loops
3.1 Print all the characters of the driver's name, separated by a space and in capitals i.e. "J O H N"*/

console.log(hacker1.toUpperCase().split("").join(" "));