Created
September 21, 2010 17:11
-
-
Save karlseguin/590059 to your computer and use it in GitHub Desktop.
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 setup(method) | |
{ | |
method = fake; | |
}; | |
function fake() | |
{ | |
return "faked"; | |
} | |
function real() | |
{ | |
return "real"; | |
} | |
setup(real); | |
console.log(real() == "faked"); | |
/* this works but isn't as pretty */ | |
function setup(method) | |
{ | |
return fake; | |
}; | |
... | |
real = setup(real); | |
console.log(real() == "faked"); |
darrenkopp
commented
Sep 21, 2010
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment