i'm having a prototype model where i need to include the following extension methods into prototype.
String.prototype.startsWith = function(str){
return (this.indexOf(str) === 0);
}
Example: [JS]
sample = function(){
this.i;
}
sample.prototype = {
get_data: function(){
return this.i;
}
}
In the prototype model how can i use the extension mehods or any other way to create extension methods in JS prototype model.