Skip to content

Instantly share code, notes, and snippets.

View sirjerky's full-sized avatar

Adam Brown sirjerky

  • Greater Seattle Area
View GitHub Profile
// Implement a decorator function that takes
// a function as an argument and will track
// how many times the passed function was called.
function Add(x, y) {
return x + y;
}
var addCallCount = countDecorator(Add);
// Given the following data structure
// implement a oldestLivingFather method
// that will return the name of the oldest
// living father.
var people = [
{
name: 'Hank',
age: 29,
father: 'Don'
@sirjerky
sirjerky / xor.js
Created April 10, 2014 03:15 — forked from hankyates/xor.js
// Using a ternary operator. Implement an exclusive OR function called `preferredName` that has the following interface:
var FirstName,
LastName;
preferredName(FirstName, LastName);
// -> false
FirstName = 'Hank';