喜鍵和值我需要在兩個單獨的數組一個關鍵月份,一個用於鍵值來獲取月ANS值分別爲下面提及的數據獲得兩個單獨的數組
var data = [{month: "JUL", value:"5"},
{month: "AUG", value:"7"},
{month: "SEP", value:"9"},
{month: "OCT", value:"11"},
{month: "NOV", value:"13"},
{month: "DEC", value:"15"},
{month: "JAN", value:"17"},
{month: "FEB", value:"19"},
{month: "MAR", value:"21"},
{month: "APR", value:"23"},
{month: "MAY", value:"25"},
{month: "JUN", value:"27"}];
我想不要在下文提到的方式
var output = [];
for(var key in response)
for(var value in response[key])
{
output.push(response[key][value]);
}
alert("output ---------------------->"+output);
請幫助...
當您在JavaScript中使用「for ... in」時,不要忘記「hasOwnProperty」。 – 2011-05-04 07:18:42