Skip to content

Commit 302b462

Browse files
authored
Merge pull request ironhack-labs#842 from ironhack-labs/revert-832-master
Revert accidentally pushed solution
2 parents 397c8ff + a48ce70 commit 302b462

File tree

3 files changed

+1
-152
lines changed

3 files changed

+1
-152
lines changed

index.html

Lines changed: 0 additions & 19 deletions
This file was deleted.

js/index.js

Lines changed: 1 addition & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,7 @@
11
// Iteration 1: Names and Input
22

33

4-
let hacker1 = "Alex";
5-
console.log(`The driver's
6-
name is ${hacker1}`);
7-
8-
let hacker2 = "Alexander";
9-
console.log("The navigator's name is " + hacker2);
10-
114
// Iteration 2: Conditionals
12-
if (hacker1.length > hacker2.length) {
13-
console.log(
14-
`The driver has the longest name. It has ${hacker1.length} characters.`
15-
);
16-
} else if (hacker1.length < hacker2.length) {
17-
console.log(
18-
`It seems that the navigator has the longest name, it has ${hacker2.length} characters.`
19-
);
20-
} else {
21-
console.log(
22-
`Wow, you both have equally long names, ${hacker1.length} characters!`
23-
);
24-
}
25-
26-
switch (true) {
27-
case hacker1.length > hacker2.length:
28-
console.log(
29-
`The driver has the longest name. It has ${hacker1.length} characters.`
30-
);
31-
break;
32-
case hacker1.length < hacker2.length:
33-
console.log(
34-
`It seems that the navigator has the longest name, it has ${hacker2.length} characters.`
35-
);
36-
break;
37-
default:
38-
console.log(
39-
`Wow, you both have equally long names, ${hacker1.length} characters!`
40-
);
41-
}
42-
43-
console.log("ITERATION 3")
44-
45-
// Iteration 3: Loops
46-
// 3.1 Print all the characters of the driver's name, separated by a space and in capitals i.e. "J O H N"
47-
// let driver = [];
48-
// for(let i=0; i<hacker1.length; i++){
49-
// driver.push(hacker1[i])
50-
// }
51-
console.log( hacker1.split('').join(' ').toUpperCase() )
52-
53-
54-
console.log('3.2 Print all the characters of the navigators name, in reverse order. i.e. "nhoJ"')
55-
56-
let navigatorReverse = []
57-
for(let i=hacker2.length-1; i>=0; i--){
58-
console.log(i)
59-
navigatorReverse.push(hacker2[i])
60-
}
61-
62-
console.log( navigatorReverse.join('') )
63-
64-
// console.log( hacker2.split('').reverse().join('') )
65-
66-
console.log(`3.3 Depending on the lexicographic order of the strings, print:
67-
- The driver's name goes first.
68-
- Yo, the navigator goes first definitely.
69-
- What?! You both have the same name?`)
70-
71-
let names = [hacker1, hacker2];
72-
console.log(names)
73-
74-
names.sort();
75-
console.log(names)
76-
77-
78-
// if(hacker1.length < hacker2.length){
79-
// console.log(`The ${hacker1} name goes first.`)
80-
// }
81-
// else if (hacker2.length < hacker1.length){
82-
// console.log(`Yo, the ${hacker2} goes first definitely.`)
83-
// }
84-
// else {
85-
// console.log(`What?! You both have the same name?`)
86-
// }
87-
88-
89-
if ( hacker1.localeCompare(hacker2) === -1){
90-
console.log(`The ${hacker1} name goes first.`)
91-
}
92-
else if ( hacker1.localeCompare(hacker2) === 1) {
93-
console.log(`Yo, the ${hacker2} goes first definitely.`)
94-
}
95-
else {
96-
console.log(`What?! You both have the same name?`)
97-
}
98-
99-
// hacker1.localeCompare(hacker2) === -1 ? : "true dogs" : "false cats"
100-
// // 2 + 2 === 5 ? "true dogs" : "false cats"
101-
// // "false cats"
102-
103-
104-
105-
106-
let par1 = `25 shmeckles? I-I-I-I don't even know what that- what is that? Is that a lot? There's pros and cons to every alternate timeline. Fun facts about this one – It's got giant, telepathic spiders, 11 9/11s, and the best ice cream in the multiverse! This is because you give Morty Smith bad grades, bitch! Listen, Morty, I hate to break it to you but what people call love is just a chemical reaction that compels animals to breed`
107-
108-
let par2 = `If you break the rules, try to leave or lose the game, you will die. Just like Saaaaw. Not today bitch! Flip the pickle over. Wow, so your origin is what? You fell into a vat of redundancy?`
109-
110-
let par3 = `"And"? What more youtube do you want tacked on to this? I turned myself into a pickle, and 9/11 was an inside job?" He threatened to turn me in to the government, so I made him and the government go away! I'm Mr. Crowbar, and here is my friend, who is also a crowbar! Must… continue… moving… in… ways… that… lead… to… dying… with… you.`
111-
112-
113-
114-
115-
console.log((par1 + par2 + par3).split(' ').length)
116-
117-
let par = par1 + par2 + par3 //Made it into one string
118-
119-
console.log( par.split('you').length - 1 )
120-
121-
//RegExp
122-
console.log( par.match(/you/g).length )
123-
124-
125-
126-
let phraseToCheck = "A man, a plan, a canal, Panama!"
127-
phraseToCheck = phraseToCheck.replace(/[,! ]/g,"").toLowerCase()
128-
129-
130-
let reversePhrase = phraseToCheck.split('').reverse().join('')
1315

132-
console.log(phraseToCheck)
133-
console.log(reversePhrase)
134-
console.log(phraseToCheck == reversePhrase)
1356

7+
// Iteration 3: Loops

styles.css

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)