-
Notifications
You must be signed in to change notification settings - Fork 5.9k
BCN Julio + Montse #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BCN Julio + Montse #154
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,38 @@ | ||
| // Names and Input | ||
| var hacker1 = "Montse"; | ||
| console.log("The driver's name is " + hacker1); | ||
|
|
||
| var hacker2 = prompt("Enter navigator's name"); | ||
| console.log("The navigator's name is " + hacker2) | ||
|
|
||
| //Conditionals | ||
| if (hacker1.length > hacker2.length) { | ||
| console.log("The driver has the longest name, it has " + hacker1.length + "characters.") | ||
| } else if (hacker2.length > hacker1.length) { | ||
| console.log("The navigator has the longest name, it has " + hacker2.length + "characters.") | ||
| } else { | ||
| console.log("Wow, you both got equally long names, " + hacker1.length + "characters!!!!!!!") | ||
| }; | ||
|
|
||
| var name = ""; | ||
| var uppercase = hacker1.toUpperCase(); | ||
| var name2 = ""; | ||
| for (var i=0; i<hacker1.length; i++) { | ||
| name += uppercase[i]+ " "; | ||
| } | ||
| console.log(name); | ||
| var value = hacker1.length -1; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's ok, but you don't need to create a variable for that. It will not modify its value if you modify the hacker1 variable later in your program. |
||
| for (var i=value; i>=0; --i) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can do then: |
||
| name2 += hacker1[i]; | ||
| } | ||
| console.log(name2); | ||
|
|
||
|
|
||
| // Lorem ipsum generator | ||
| if (hacker1 > hacker2) { | ||
| console.log("The driver's name goes first.") | ||
| } else if (hacker2 > hacker1) { | ||
| console.log("The navigator's name goes first.") | ||
| } else { | ||
| console.log("You both have the same name.") | ||
| }; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
|
|
||
| <head> | ||
| <title>Hello, world!</title> | ||
| <meta charset="utf-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
| </head> | ||
|
|
||
| <body> | ||
| <h1>Hello World</h1> | ||
| <script src="basic-algorithms.js"></script> | ||
| </body> | ||
| </html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool!