Skip to content

Instantly share code, notes, and snippets.

@lyuehh
Created July 26, 2013 08:28
Show Gist options
  • Save lyuehh/6087214 to your computer and use it in GitHub Desktop.
Save lyuehh/6087214 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
</body>
</html>
//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());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment