Skip to content

Instantly share code, notes, and snippets.

@hankyates
Last active August 29, 2015 13:57
Show Gist options
  • Save hankyates/9680217 to your computer and use it in GitHub Desktop.
Save hankyates/9680217 to your computer and use it in GitHub Desktop.
Code Fellows XOR
// Implement an exclusive OR function called `preferredName` that has the following interface:
var FirstName,
LastName;
preferredName(FirstName, LastName);
// -> false
FirstName = 'Hank';
preferredName(FirstName, LastName);
// -> 'Hank'
LastName = 'Yates';
preferredName(FirstName, LastName);
// -> false
FirstName = '';
preferredName(FirstName, LastName);
// -> 'Yates'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment