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
34 changes: 34 additions & 0 deletions starter-code/basic-algorithms.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
var hacker1;
hacker1 = "claudia";
console.log("the driver's name is" + " " + hacker1 );
var hacker2;
hacker2 = "summer";
console.log("the navigator's name is" + " " + hacker2);
hacker1.length = 7;
hacker2.length = 6;
if (hacker1< hacker2) {
console.log("The driver's name is longer")
}
else if (hacker2 > hacker1) {
console.log("The navigaor has the longest name")
}
else if (hacker1 === hacker2) {
console.log("both names are long");
}
console.log(hacker1.toUpperCase().split('').join(' '));
var array;
function reverseString(str) {
array = str.split("");
array.reverse();
str = array.join('');
return str;
}
reverseString("Summer");
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 have the same name")
}
// Names and Input


Expand Down