Skip to content

PAR Jihad & Diane - #149

Closed
Dianedel wants to merge 1 commit into
ironhack-labs:masterfrom
Dianedel:master
Closed

PAR Jihad & Diane#149
Dianedel wants to merge 1 commit into
ironhack-labs:masterfrom
Dianedel:master

Conversation

@Dianedel

Copy link
Copy Markdown

@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++) {

Copy link
Copy Markdown

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) {

Copy link
Copy Markdown

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
Copy Markdown

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