forked from ironhack-labs/lab-javascript-basic-algorithms
-
Notifications
You must be signed in to change notification settings - Fork 48
Lis-WDFT-APR23-Robson-Ana #24
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
Open
RobBatista
wants to merge
1
commit into
MrAFerreira:main
Choose a base branch
from
RobBatista:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,57 @@ | ||
// Students Ana and Robson | ||
|
||
console.log("I'm ready!"); | ||
|
||
// Iteration 1: Names and Input | ||
let hacker1 = "Robson"; | ||
let hacker2 = "Ana"; | ||
|
||
console.log(`The driver's name is ${hacker1}`); | ||
console.log(`The navigator's name is ${hacker2}`); | ||
|
||
// Iteration 2: Conditionals | ||
|
||
if (hacker1.length > hacker2.length){ | ||
console.log(`The driver has the longest name, it has ${hacker1.length} characters.`); | ||
} | ||
else if (hacker1.length < hacker2.length){ | ||
console.log(`It seems that the navigator has the longest name, it has ${hacker2.length} characters.`); | ||
} | ||
else if (hacker1.length = hacker2.length){ | ||
console.log(`Wow, you both have equally long names, ${hacker2.length} characters!`); | ||
} | ||
|
||
// Iteration 3: Loops | ||
let nameUpperSpace = ""; | ||
|
||
for (let i = 0; i < hacker1.length; i++){ | ||
nameUpperSpace += hacker1[i] + " "; | ||
} | ||
console.log(nameUpperSpace.toUpperCase()); | ||
|
||
let nameReverse = "" | ||
|
||
for (let i = hacker2.length - 1; i >= 0; i--) { | ||
nameReverse += hacker2[i]; | ||
} | ||
|
||
console.log(nameReverse); | ||
|
||
let result = hacker1.localeCompare(hacker2); | ||
|
||
if (result < 0) { | ||
console.log("The driver's name goes first"); | ||
} | ||
else if (result >= 1) { | ||
console.log("Yo, the navigator goes first definitely."); | ||
} | ||
else { | ||
console.log("What!? You both have the same name?"); | ||
} | ||
|
||
|
||
let longText = `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ullamcorper vulputate nisi, vitae ultrices urna congue eu. Aliquam ultrices arcu id gravida consectetur. Nunc lacinia ligula ut congue fermentum. Etiam quis eleifend libero. Nullam nulla quam, bibendum non quam sit amet, rutrum finibus nunc. Etiam vestibulum est sed ante vehicula rhoncus. Fusce nec ornare purus. Phasellus vitae maximus nibh, in tempor purus. Ut fermentum hendrerit commodo. Proin ac enim fringilla, tincidunt quam sit amet, venenatis est. Pellentesque feugiat felis in porttitor bibendum. | ||
|
||
Integer sed pharetra sapien. Pellentesque rhoncus nisi eget condimentum cursus. Curabitur ipsum massa, tincidunt sed sollicitudin suscipit, posuere quis risus. Duis a nisi dapibus, accumsan massa vitae, porta dolor. Proin porttitor quis sapien sed egestas. Nam eget metus id tortor sagittis blandit. Proin a sollicitudin ipsum, ornare lacinia massa. Aenean vitae nunc scelerisque, sodales nulla a, ullamcorper nunc. Duis convallis finibus justo vel placerat. Praesent rutrum magna sem, quis sagittis diam accumsan tristique. Curabitur sagittis mattis elementum. Vestibulum sollicitudin turpis vel augue dapibus, eget dictum erat tincidunt. Sed pellentesque dignissim odio eget accumsan. | ||
|
||
Nunc rhoncus est vel metus consequat aliquet. Sed eget justo at lorem dictum aliquet tincidunt et nibh. Morbi sollicitudin tellus eget congue egestas. Etiam auctor sed nisl eget fermentum. Integer id faucibus mauris. Vestibulum luctus mi ac lorem ornare, sed mollis risus consequat. Ut velit arcu, venenatis eu mauris et, ultricies dictum lorem. Praesent eleifend scelerisque tristique. Proin dapibus, ex eget sodales egestas, quam purus posuere purus, et sagittis enim leo nec nulla. Pellentesque nisi odio, rutrum a faucibus non, imperdiet ac justo. In euismod nec mauris eu ultrices. Sed quis metus metus. Donec in dignissim urna. Aliquam euismod eleifend dictum. Sed imperdiet erat non egestas tincidunt.` | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
When you want to compare something you need to use either
==
or===
if you use just one equal sign=
you are assigning a new value