Skip to content

Instantly share code, notes, and snippets.

@JesterXL
Last active August 29, 2015 14:21
Show Gist options
  • Save JesterXL/db3a7c68bff46fb9ac23 to your computer and use it in GitHub Desktop.
Save JesterXL/db3a7c68bff46fb9ac23 to your computer and use it in GitHub Desktop.
Why anUncheck works
function anUnchecked()
{
'use strict';
return true;
}
function getPlayer()
{
return {
isWorthy: anUnchecked
}
}
function determineIfWorthy(player)
{
return player.isWorthy();
}
var players = [getPlayer(), getPlayer(), getPlayer()];
console.log(players.map(determineIfWorthy));
// [true, true, true]
// You can even borrow the function inline:
console.log(players.map(getPlayer().isWorthy));
// // [true, true, true]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment