Skip to content

Instantly share code, notes, and snippets.

Created Jan 18, 2016
What would you like to do?
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