如何在函数之外获取数组的所有内容?
$.each(Basepath.Templates, function(i){
templateArray = new Array({title: Basepath.Templates[i].Template.name, src: 'view/'+Basepath.Templates[i].Template.id, description: Basepath.Templates[i].Template.name});
});
console.log(templateArray); //contains only one array;
编辑:
这是我想要的输出
templateArray[
{
title: "one",
src: "view/1",
description: "Descrption 1"
},
{
title: "two",
src: "view/2",
description: "Descrption 2"
},
{
title: "one",
src: "view/3",
description: "Descrption 3"
}
]