What is Protorype in script

sainath3
Mega Guru

Hi Team,

 

Can anyone please elaborate what is Prototype in below script.

 

Var Pirate=Class.create();

Pirate.prototype= {

initialize: function(name) {

this.name=name;

}

}

1 REPLY 1

Community Alums
Not applicable

Hi @sainath3 ,

Prototype is, in fact, a key feature of JavaScript - http://javascriptissexy.com/javascript-prototype-in-plain-detailed-language/



The call function refers to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call

In short, you can roughly read it as "Considering this as the current subject, treat it as WFActivityHandler and execute the initialize method with no parameter"

It is particularly useful if you need to handle inheritance with JavaScript, when you can't call a method of the super class with the super keyword like Java.