Created
July 26, 2013 08:28
-
-
Save lyuehh/6087215 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
</body> | |
</html> |
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
//String.prototype. | |
console.log(typeof String); | |
console.log(typeof Object); | |
String.prototype.aa = function() { | |
alert(this); | |
//console.log(this); | |
return 'aa'; | |
}; | |
console.log("asdf".aa()); | |
Function.prototype.method = function(name, func) { | |
this.prototype[name] = func; | |
return this; | |
}; | |
String.method('bb', function() { | |
return 'bb'; | |
}); | |
console.log("asdf".bb()); |
Author
lyuehh
commented
Jul 26, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment