Paris - Alexandre - Bastien#299
Closed
alexjoly13 wants to merge 1 commit into
Closed
Conversation
ta-web-paris
reviewed
Jan 8, 2019
| var alphabet = "abcdefghijklmnopqrstuvwxyz"; | ||
| var candidate = prompt("Testez la palindromie du mot"); | ||
| for (i=0 ; i <= candidate.length-1; i++) { | ||
| if (!alphabet.includes(candidate[i])) {candidate=candidate.substr(0,i-1)+candidate.substr(i+1,candidate.length-1); |
There was a problem hiding this comment.
I'm not entirely sure what you are trying to do here. There is an easier way to check to see if it's a palindrome
if (nameNormal.replace(" " ,"") === nameReversed.replace(" ", "")) {
console.log("It's a palindrome !!");
} else {
console.log("It's not a palindrome...");
};
ta-web-paris
reviewed
Jan 8, 2019
| var hacker2 = prompt("Enter the navigator's name"); console.log("The navigator's name is " + hacker2); | ||
| if (hacker1.length === hacker2.length) { | ||
| console.log("wow, you both got equally long names, " + hacker1.length + " characters!!") } | ||
| else if (hacker1.length <= hacker2.length) { |
There was a problem hiding this comment.
here you don't want to be checking if it's greater than or equal to- you only want to check to see if it is greater than since you're checking for the longest name
|
What you've done is good! You seem to understand how loops work which will be important throughout the course 💪 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
@basttran