forked from ironhackbcn/lab-javascript-basic-algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic-algorithms.js
More file actions
22 lines (20 loc) · 737 Bytes
/
basic-algorithms.js
File metadata and controls
22 lines (20 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Names and Input
var hacker1 = 'Gerard';
console.log("The driver's name is ", hacker1);
var hacker2;
document.write(hacker2);
console.log("The navegator's name is ", hacker2);
//Conditionals
if (String.length(hacker1) > String.length(hacker2)) {
console.log("The Driver has the longest name, it has", String.length(hacker1), "characters or");
}
else if (String.length(hacker1) < String.length(hacker2)) {
console.log("Yo, navigator got the longest name, it has ", String.length(hacker2), " characters");
}
else {
console.log("wow, you both got equally long names, ", String.length(hacker1), " characters!!")
}
// Lorem ipsum generator
for (var i = 0; i < toString.length(hacker1); ++i) {
console.log(hacker1[i].toUpperCase);
}