Created
March 23, 2015 08:20
-
-
Save samarpanda/95abba4e60e22fae9f31 to your computer and use it in GitHub Desktop.
Building a quick library :)
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
| var propMap = { | |
| val: "value", | |
| html: "innerHTML" | |
| }; | |
| for(var fnName in propMap){ | |
| $.prototype[fnName] = function(prop){ | |
| return function(){ | |
| return this[prop]; | |
| } | |
| })(propMap[fnName]); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment