Created
September 19, 2012 04:53
-
-
Save kostysh/3747744 to your computer and use it in GitHub Desktop.
Malkovich malkovich
This file contains hidden or 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() { | |
var malkovich = function(malkovich) { | |
(function() { | |
for (var malkovich in arguments[0]) { | |
if (arguments[0][malkovich] && | |
typeof arguments[0][malkovich].malkovich === 'function') { | |
arguments[0][malkovich].malkovich.call(); | |
} | |
} | |
})(malkovich); | |
}; | |
Function.prototype.malkovich = function() { | |
return 'malkovich'; | |
}; | |
Object.prototype.malkovich = function() { | |
switch (typeof this.malkovich) { | |
case 'function': | |
for (var malkovich in this) { | |
if (malkovich.isPrototypeOf(this) && | |
typeof this[malkovich] === 'function') { | |
return this[malkovich].call(); | |
} | |
} | |
break; | |
case 'undefined': | |
default: | |
this.malkovich = 'malkovich'; | |
} | |
}; | |
Array.prototype.malkovich = function() { | |
if (this.push) { | |
this.push('malkovich'); | |
return this; | |
} else { | |
return 'malkovich'; | |
} | |
}; | |
String.prototype.malkovich = function() { | |
return this + 'malkovich'; | |
}; | |
malkovich.call(window); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
malkovich