Skip to content

[LIS-WDFT-APR2023] Henrique Ortiz #27

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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Ricozzo
Copy link

@Ricozzo Ricozzo commented Apr 10, 2023

No description provided.

Copy link

@joaopdg joaopdg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on the lab Henrique and Guy, next time try to do the bonus!

for (i = 0; i < hacker1.length; i++) {
driver = driver + hacker1[i] + " ";
}
console.log(driver.toUpperCase());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use the .toUpperCase() method inside the loop, otherwise you are not saving the string with the upper cased letters, you are just console logging it:

let driver = ""

for (i = 0; i < hacker1.length; i++) {
    driver = driver + hacker1[i].toUpperCase() + " ";
}

console.log(driver);

if (hacker2.localeCompare(hacker1)===1) {
console.log("The driver's name goes first.");
}
else if (hacker1.localeCompare(hacker2)===1) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.localCompare() returns 1, 0 or -1 so here your condition should be checking if it is equal to -1:

( ... )
else if (hacker1.localeCompare(hacker2) === -1) 
( ... )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants