-
Notifications
You must be signed in to change notification settings - Fork 48
[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
base: main
Are you sure you want to change the base?
Conversation
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.
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()); |
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.
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) { |
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.
.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); |
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.
.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)
No description provided.