pageCounter
ページ内のオブジェクト (以下を参照) が int ではなく文字列として扱われるのはなぜですか? javascript が変数を解釈せず、変数の名前をリテラル文字列として使用するのはなぜですか?
for (var i in stories){
//reset the counter when it hits the number of stories per page
if (counter >= divsByPage) {
counter = 1;
pageCounter++;
}
//turn all the stories off
//stories[i].style.display = "none";
//insert a new story under a page array
pages.push({pageCounter:stories[i]});
counter++;
}
console.log(pages[1]);
出力しますObject { pageCounter=[1]}
。