This file contains 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
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