Created
September 23, 2011 05:30
-
-
Save joseanpg/1236801 to your computer and use it in GitHub Desktop.
Consulta
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
var one = function(arg){return 'Hola ' + arg;}; | |
var two = function(arg){return 'Adios ' + arg;}; | |
alert(one('Otoño')); | |
alert(two('Verano')); | |
//Siglos después descubrimos que hay que preprocesar el argumento :) | |
Function.prototype.makeCoat = function() { | |
var service = this; | |
return function(client) { | |
return function(arg){ | |
return client.call(this,service(arg)); | |
} | |
} | |
} | |
var coat = function(arg){alert('Preprocesando '+arg);return arg.toUpperCase()}.makeCoat(); | |
one = coat(one); | |
two = coat(two); | |
alert(one('Otoño')); | |
alert(two('Verano')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment