未捕获的TypeError不是带有原型的函数-javascript类

未捕获的TypeError不是带有原型的函数-javascript类,javascript,prototype,Javascript,Prototype,我没有从javascript中得到函数错误 这是我定义的对象的一部分: Product.Config.prototype.configureSubscribe = function(funct) { this.configureObservers.push(funct); }; 之后,我创建另一个对象: Product.ConfigurableSwatches = Class.create(); Product.ConfigurableSwatches.prototype

我没有从javascript中得到函数错误

这是我定义的对象的一部分:

Product.Config.prototype.configureSubscribe = function(funct)
{
    this.configureObservers.push(funct);
};
之后,我创建另一个对象:

  Product.ConfigurableSwatches = Class.create();
    Product.ConfigurableSwatches.prototype = {
    initialize: function(productConfig, config) {
            // redefine some default options if configured
            if (config && typeof(config) == 'object') {
                this.setConfig(config);
            }
            this.productConfig = productConfig;
            // Store configurable attribute data
            var attributes = [];
            for (var i in productConfig.config.attributes) {
                attributes.push(productConfig.config.attributes[i]);
            }
            this.configurableAttributes = attributes;
            // Run it
            this.run();
            return this;
        },
    run: function() {
        // HERE IT BREAKS
        this.productConfig.configureSubscribe(this.onSelectChange.bind(this));
    }
}
我遇到以下错误:

Uncaught TypeError: this.productConfig.configureSubscribe is not a function

有人能告诉我问题出在哪里吗?

这行
this.productConfig=productConfig
应该是

this.productConfig = new productConfig()

使用其原型创建新对象

this.productConfig=new productConfig();仅当OP没有遵循JavaScript中的常规大小写约定时。不过,在其他地方,OP似乎都在跟进@bla009调用
Product.ConfigurableSwatches.init
的代码在哪里?能否从代码中添加一些工作代码分叉。@CodeiSir初始值设定项缺失。我在
Product.ConfigurableSwatches
之前添加了它。你能加上你的答案吗?这样我就可以把它标为正确答案了。