Skip to content

Instantly share code, notes, and snippets.

@conanak99
Created January 18, 2016 17:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save conanak99/8ea0070735d797426560 to your computer and use it in GitHub Desktop.
var str = 'abc'; // str là string, cha nó là String.prototype
// nhân đôi chuỗi đưa vào
String.prototype.duplicate = function() { return this + this; }
console.log(str.duplicate()); // Tìm thấy hàm duplicate trong prototype
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment