私は実際に答えを見つけるためにこの質問をする方法を知りませんでした。変数を持つオブジェクトに行く
は、だから私はそう
function gatherDataForGeographic(ele) {
var $this = $(ele)
var $main_title = $this.find('.options-title'),
$option = $this.find('.option');
var arr = []
var reportAreas = reportManager.getReportAreasObject();
$option.each(function() {
var $this = $(this)
var $checkbox = $this.find('.checkbox');
var type = $this.data('type'),
index = $this.data('index');
if ($checkbox.hasClass('checkbox--checked')) {
console.log(reportAreas.type)
} else {
return true;
}
})
return arr;
}
//this will return an object that I need to index
var reportAreas = reportManager.getReportAreasObject();
//this will get the a key that i need from the object
var type = $this.data('type');
//this will give me the index I need to grab
var index = $this.data('index');
に、この機能は、それが持っている何をするつもりされている3つの変数を持っているもの、私はからタイプ(またはキー)に基づいてオブジェクトを通過さやろうとしていますユーザーが選択したオプション
問題... reportArea.type[index]
を探していて、変数として認識していません。タイプが存在しないため、undefined
を取得し続けます。
型が変数でありキーではないことを確認する方法はありますか?
完璧です、それは簡単でした。どうもありがとうございます!時間が許せば、これを答えとして受け入れます。 – Christian4423