4
は、だから私はこの文脈で鍵を参照することは可能ですか?
this.PauseFunctions = {
2: {
OnSlideTo: function() {
console.log("The OnSlideTo function of the event at the 2-second mark was called");
},
OnSlideAway: function() {
console.log("The OnSlideAway function of the event at the 2-second mark was called");
}
},
5: {
OnSlideTo: function() {
console.log("The OnSlideTo function of the event at the 5-second mark was called");
},
OnSlideAway: function() {
console.log("The OnSlideAway function of the event at the 5-second mark was called");
}
}
};
のようなデータ構造を持っており、その可能なら、私はその値OnSlideTo
機能を含むオブジェクトであるキーを参照するために私は思ったんだけど。私のプログラムは、より一般的で保守できるようにkey
が2
ある
2: {
OnSlideTo: function() {
console.log("The OnSlideTo function of the event at the " + key + "-second mark was called");
},
OnSlideAway: function() {
console.log("The OnSlideAway function of the event at the " key + "-second mark was called");
}
}
にそれを変更する方法がありますたとえば、
2: {
OnSlideTo: function() {
console.log("The OnSlideTo function of the event at the 2-second mark was called");
},
OnSlideAway: function() {
console.log("The OnSlideAway function of the event at the 2-second mark was called");
}
}
に私は思ったんだけど。
。 –
なぜ、それらの場所にツリー関数が必要ですか? – Amit