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
74 changes: 71 additions & 3 deletions starter-code/basic-algorithms.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,75 @@
// Names and Input


//Conditionals
let hacker1 = "will";
let hacker2 =prompt('What is your name?');



if (hacker1.length == hacker2.length){

console.log("wow, you both got equally long names," +" "+ hacker1.length +" "+ "characters!!");

}
else if(hacker2.length > hacker1.length){
console.log("Yo, navigator got the longest name, it has" +" "+ hacker2.length +" "+ "characters");
}

else if(hacker1.length > hacker2.length) {
console.log("The Driver has the longest name, it has"+ hacker1.length +"characters");
}


// console.log(hacker1.toUpperCase().split());

//loop

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

for(let i = hacker2.length - 1; i >= 0; i--){
console.log(hacker2[i]);
}



// let x = order.((x)=> x.localeCompare());

if (hacker1.localeCompare(hacker2)==0){
console.log("You Guys got the same name");
}

if(hacker1.localeCompare(hacker2)==-1){
console.log(hacker1+"'s name goes first");
}

if (hacker1.localeCompare(hacker2)==1){
console.log("Yo, the navigator goes first definitely ")
}


let thisIsAString = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus pretium tempor blandit. Donec eu pretium ligula. Integer faucibus libero magna, nec rhoncus nunc aliquam a. Aliquam in placerat magna, et convallis risus. Ut id nibh nisl. Pellentesque consequat nunc luctus, vulputate quam eu, fermentum massa. Suspendisse ut eros ultrices, elementum tortor id, tempus libero";

let stringCount = thisIsAString;

for (let i = 0; i < stringCount.length; i++){

let et = stringCount.charAt(i);

if(et == "i"){
let count = 0;

count +=1;

console.log(count);

}

}







// Lorem ipsum generator
16 changes: 16 additions & 0 deletions starter-code/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
</head>
<body>


<script src="basic-algorithms.js"></script>
</body>
</html>