What is Protorype in script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2023 05:52 AM
Hi Team,
Can anyone please elaborate what is Prototype in below script.
Var Pirate=Class.create();
Pirate.prototype= {
initialize: function(name) {
this.name=name;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2023 05:57 AM
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.