-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[ING-FT-112019]-Kai and Tomasz #579
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
Conversation
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 |
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.
prefer an explicit condition like " === "
let str = ""; | ||
|
||
for (let i = 0; i < hacker1.length; i++) { | ||
str = str + hacker1.charAt(i) + " "; |
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.
prefer hacker1[i]
let str2 = ""; | ||
|
||
for (let i = hacker2.length - 1; i >= 0; i--) { | ||
str2 = str2 + hacker2.charAt(i); |
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.
prefer hacker2[i]
console.log(`The driver's name goes first`); | ||
else if (hacker1 > hacker2) | ||
console.log(`Yo, the navigator goes first definitely.`); | ||
else |
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.
prefer explicit condition like " = "
|
||
for (let i = 0; i <= text.length; i++) { |
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.
ERROR: correct to i < text.length
let found = 0; |
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.
Could be greatly simplified. Please read documentation about indexOf()
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.
Iteration 3: prefer localeCompare() as per instructions
Some minor comments
|
||
let str = ""; | ||
|
||
for (let i = 0; i < hacker1.length; i++) { |
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.
prefer use of localeCompare() as per lesson instructions
This pull request has been automatically marked as stale because it didn't have any recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This pull request is closed. Thank you. |
No description provided.