Skip to content

MIA // Eleyni & Claudia H // javascript-basic-algorithms #86

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

Closed
wants to merge 1 commit into from

Conversation

erodrig1010
Copy link

No description provided.

@erodrig1010 erodrig1010 changed the title IronHack Miami - Claudia H & Eleyni MIA-Eleyni/Claudia H-javascript-basic-algorithms Apr 2, 2018
@erodrig1010 erodrig1010 changed the title MIA-Eleyni/Claudia H-javascript-basic-algorithms MIA // Eleyni & Claudia H // javascript-basic-algorithms Apr 2, 2018
var driver = " "
for (var i = 0; i < hacker1.length; i++) {
driver += hacker1.toUpperCase()[i] + " ";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This works. The other way would be using JS methods:

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

return str.split('').reverse().join('');

}
reverse(hacker2);
Copy link
Contributor

Choose a reason for hiding this comment

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

Great!

console.log("Yo, tha navigator goes first definitely");
} else {
console.log("what?! you both got the same name?");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Try this way:

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

Google what .localeCompare() does and ask us if you have any questions.

@sandrabosk
Copy link
Contributor

Good job so far. If you have time, try working on bonus part. 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
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