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