Skip to content

[LIS-WDFT-APR23] Erik #30

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 4 commits into
base: main
Choose a base branch
from
Open

[LIS-WDFT-APR23] Erik #30

wants to merge 4 commits into from

Conversation

k-129
Copy link

@k-129 k-129 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.

Good job on the lab Erik and Francisco, take a look at the corrections that I left you below and try to apply them!

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 (let i = 0; i < Hacker1.length; i++){ 
    driver = driver + Hacker1[i].toUpperCase() + " ";
}

console.log(driver.toUpperCase());


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) 
( ... )


//wordCount = longText.length-1;
//console.log(wordCount);
console.log(longText.length);
Copy link

Choose a reason for hiding this comment

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

.length will return you the amount of characters in longText and not the ammount of words. So one way of counting the words is counting the number of spaces between words (similar to the for loop that you have below)

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