Skip to content

Instantly share code, notes, and snippets.

@conanak99

conanak99/prototype1.js Secret

Created Jan 18, 2016
Embed
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