Phpworker
answered Nov 30 '-1 00:00
You can say its late binding to object in JavaScript by prototype. . dynamically add more method or variable to object or function in JavaScript by prototype.
function main(){
// i forget to code here
}
suppose you have main function and now you need to attach it with more variable or function . you can do it dynamically at any point of the coding in JavaScript by prototype. .
function main(){
// i forget to code here
}
main.prototype.sub = function(){
alert("me using prototype method.");
};
i add sub function as late binding to main function . so you can attach more and more variable and function in JavaScript by prototype.
correct me if i am wrong