forked from ironhack-labs/lab-javascript-basic-algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
34 lines (23 loc) · 814 Bytes
/
index.js
File metadata and controls
34 lines (23 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Iteration 1: Names and Input
let hacker1 = "The driver's name is Jackson Williams";
console.log (hacker1);
let hacker2 = "The navigator's name is Peter Griffin";
console.log (hacker2);
// Iteration 2: Conditionals
const hacker1Name = "Jackson Williams";
console.log (hacker1Name.length);
const hacker2Name = "Peter Griffin";
console.log (hacker2Name.length);
let longestName = "The driver has the longest name, it has 16 characters.";
console.log (longestName);
// Iteration 3: Loops
let driver = "Jackson";
console.log (driver.toUpperCase());
let navigator = "Peter";
let reversed = "";
for (let i = navigator.length -1; i>= 0; i--) {
reversed += navigator[i];
}
console.log (reversed);
let LexicOrder = "The driver's name goes first.";
console.log (LexicOrder);