Skip to content

FTWD Miami Osse Laborde - #97

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

FTWD Miami Osse Laborde#97
olaborde wants to merge 1 commit into
ironhack-labs:masterfrom
olaborde:master

Conversation

@olaborde

@olaborde olaborde commented Apr 2, 2018

Copy link
Copy Markdown

No description provided.


for (var x=0;x <= hacker1.length; x++) {
console.log(hacker1.charAt(x).toUpperCase(x));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great approach! The other way could be:

for (var i = 0; i < 1; i++) {
  console.log(
    hacker1
      .split("")
      .join(" ")
      .toUpperCase()
  );
}

return joinArray;
}
console.log(reverseString(hacker1));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Again good way of thinking. The same but maybe a bit shorter way would be:

for (var i = 0; i < 1; i++) {
  console.log(
    hacker1
      .split("")
      .reverse(" ")
      .join("")
  );
}


}

else if (hacker1 > hacker2){

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The logic is there but the syntax is not. We could use something like this:

var n = hacker1.localeCompare(hacker2);
if (n === 1) {
  console.log("The driver's name goes first");
} else if (n === -1) {
  console.log("Yo, the navigator goes first definitely");
} else {
  console.log("What?! You both got the same name?");
}
console.log(n);

Try googling .localeCompare() to see how this method works.

@sandrabosk

Copy link
Copy Markdown
Contributor

Good job! Thank you for submitting.

@sandrabosk sandrabosk closed this Apr 3, 2018
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