I am trying create a prototype of function using object.
var lib = function(){
return true;
};
lib.prototype = {
some: () => {
console.log("prototype is called");
}
}
lib.some();
it's not working
you must define an object from lib function and use it
LIKE THIS:
var lib = function(){
return true;
};
lib.prototype = {
some: () => {
console.log("prototype is called");
}
}
let a=new lib();
a.some();
OR use new
var lib = function(){
return true;
};
lib.prototype = {
some: () => {
console.log("prototype is called");
}
}
new lib().some();