Skip to content

Conversation

Dianedel
Copy link

@eloji9

We didn't get to finish the "lorem ipsum generato" part. We'll try to do it later.


//Loops
var str = "";
for (var i = 0; i < hacker1.length; i++) {

Choose a reason for hiding this comment

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

You don't need this, actually you can compare two string just by using the greater > operator, like this :

if (hacker1 < hacker2) {
  console.log("The driver's name goes first");
} else if (hacker2 < hacker1) {
  console.log("The navigator's name goes first");
} else {
  console.log("What?! You both got the same name?");
}

You can add a toUpperCase or toLowerCase method so they will be writting the same way otherwise :
"Diane" will be sorted before "arthur".

var strPalindrome = str.split("").reverse().join("");
strCompare.sort()

if (palindrome = strPalindrome) {

Choose a reason for hiding this comment

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

Be careful when using the = operator, in your case you are reassinging a value, if you want to compare two value you need to use at least two "==".

For exemple in your code, you are changing the value of palindrome, so the condition will be verified everytime, but if you add a second "=" it will work :)

@ta-web-paris
Copy link

If you want to finish, you can check the split method, it will be helpfull :)

Otherwise good job !

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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy