Last active
August 29, 2015 14:21
-
-
Save JesterXL/db3a7c68bff46fb9ac23 to your computer and use it in GitHub Desktop.
Why anUncheck works
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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