Skip to content

Instantly share code, notes, and snippets.

@piedoom
Last active September 28, 2016 02:48
Show Gist options
  • Save piedoom/dc32916571e88aebd6e7cec559e0fc41 to your computer and use it in GitHub Desktop.
Save piedoom/dc32916571e88aebd6e7cec559e0fc41 to your computer and use it in GitHub Desktop.
/*
* Be sure to drink your Ovaltine
*
* If you are a JavaScript nerd supreme:
*/
/*
* ...should all output "true"
*
* bonus for avoiding for loops
* bonus for creativity
*
* tweet a gist to @DominosCareers
*/
// cool, let's do this
var originalConsole = window.console;
// override console.log to always print true!
window.console = {
log: function(){
originalConsole.log(true);
}
}
// doesn't really matter what this returns
function say(){
return function(){
};
}
console.log( say("Domino's")("Pizza") === "D-o-m-i-n-o-s P-i-z-z-a" );
console.log( say("Front")("End!") === "F-r-o-n-t E-n-d" )
@piedoom
Copy link
Author

piedoom commented Sep 27, 2016

output (in browser, not with node):

true
true

@piedoom
Copy link
Author

piedoom commented Sep 27, 2016

it's pizza time

@piedoom
Copy link
Author

piedoom commented Sep 27, 2016

@nickmccurdy
Copy link

👏 🍕 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment