Object does not support this property or methodというエラーが表示されるスクリプトに取り組んでいます。IE8this
が Window オブジェクトを参照していることは確かです。
var self = {
method1: function () {
},
method2: function () {
this.method1();
}
};
オブジェクトの自己を参照するときに「これ」のこのエラーを克服する方法はありますか? に関する投稿を見たこと.call(this)
がありますが、これがここに関連しているかどうかはわかりません。ありがとう!
私は次のように関数を呼び出しています:
var Module = (function () {
var self = {
method1: function () {
},
method2: function () {
this.method1();
}
};
return self;
})();
// init
Module.method2();