Skip to content

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

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

MIA // Eleyni & Claudia H // javascript-basic-algorithms#86
erodrig1010 wants to merge 1 commit into
ironhack-labs:masterfrom
erodrig1010:master

Conversation

@erodrig1010

Copy link
Copy Markdown

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
Comment thread claudiaheleyni.js
var driver = " "
for (var i = 0; i < hacker1.length; i++) {
driver += hacker1.toUpperCase()[i] + " ";
}

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.

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

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

Comment thread claudiaheleyni.js
return str.split('').reverse().join('');

}
reverse(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.

Great!

Comment thread claudiaheleyni.js
console.log("Yo, tha navigator goes first definitely");
} else {
console.log("what?! you both got the same name?");
}

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.

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