In the following example I expect that createProduct function will be overwritten. But the result is the error.
var AbstractFactory = function(){
this.createProduct = function(){
throw new Error("The createProduct() method has not been implemented.");
}
}
AbstractFactory.prototype.createProduct = function(){
console.log('The method has been overwriten successfully');
};
var factory = new AbstractFactory();
factory.createProduct();