การสร้าง Private Methods ที่แท้จริงใน JavaScript จะทำให้แต่ละออบเจ็กต์มีสำเนาของฟังก์ชันนั้นๆ เอง สำเนาเหล่านี้จะไม่ถูก Garbage Collector ลบจนกว่าออบเจ็กต์ตัวนั้นจะถูกทำลาย
ตัวอย่าง
var Student = function (name, marks) { this.name = name || ""; // แอตทริบิวต์สาธารณะ ค่าเริ่มต้นเป็น null this.marks = marks || 300; // แอตทริบิวต์สาธารณะ ค่าเริ่มต้นเป็น null // Private method var increaseMarks = function () { this.marks = this.marks + 10; }; // Public method (เพิ่มเข้า this) this.displayIncreasedMarks = function() { increaseMarks(); console.log(this.marks); }; }; // สร้างออบเจ็กต์ Student class สร้างสำเนาของ privateMethod var student1 = new Student("Ayush", 294); // สร้างออบเจ็กต์ Student class สร้างสำเนาของ privateMethod var student2 = new Student("Anak", 411);