Skip to content

MIA-Jeyson/Stephen-lab-basic_algorithms - #91

Closed
jmxxii wants to merge 3 commits into
ironhack-labs:masterfrom
jmxxii:master
Closed

MIA-Jeyson/Stephen-lab-basic_algorithms#91
jmxxii wants to merge 3 commits into
ironhack-labs:masterfrom
jmxxii:master

Conversation

@jmxxii

@jmxxii jmxxii commented Apr 2, 2018

Copy link
Copy Markdown

No description provided.

@jmxxii jmxxii changed the title MIA-Jeyson/PP-lab-basic_algorithms MIA-Jeyson/Stephen-lab-basic_algorithms Apr 2, 2018
@ianizaguirre

Copy link
Copy Markdown

Here is some feedback.

  1. You wrote this:
// Names and Input
var hacker1 = "Stephen";
var hacker2 = "Jason";

console.log("The driver\'s name is" + " " + hacker1);
console.log("The navigator\'s name is" + " " + hacker2);
  • You don't have to put an empty pair of quotes, to create a space... You could have just added an extra space before the closing pair of quotes, like this:
console.log("The driver\'s name is " + hacker1);
console.log("The navigator\'s name is " + hacker2);
  • The condition that is more likely to happen should be the first condition, but you placed the condition that is LEAST likely to happen as the first condition to be checked... Two people having the same length name is the least likely so that should have been placed in the ELSE and not as the first IF condition
    --> This is what you wrote:
if (hacker1.length === hacker2.length){
  console.log("Wow, you both equally have long names, " + hacker1.length + " characters");
}
else if (hacker1.length > hacker2.length){
  console.log("The driver has the longest name, it has " + hacker1.length + " characters");
}
else{
  console.log("The navigator got the longest name, it has " + hacker2.length + " characters." );
}
  1. On the bonus palindrome check, you did not check if it was a palindrome - all you did was reverse the string:
var palindrome = "A man, a plan, a canal, Panama!";
var sub = "";

console.log(palindrome.length);
console.log(palindrome[0]);

for (var v = palindrome.length - 1; v >= 0; v--){
  
  sub += palindrome[v]
  
}

console.log(sub)

Other then that, Good job, guys :-)

Kind Regards,
Ian Izaguirre | Ironhack TA

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