What is the correct Underscore.js way to create a new object called items that consists of each of the item arrays. Where I could then make a POST of each item.name in one call?
var items = [];
item = [{
name: "item1",
desc: "this is a description of item 1",
qty: 1
},{
name: "item2",
desc: "this is a description of item 2",
qty: 5
},{
name: "item3",
desc: "this is a description of item 3",
qty: 3
}];
items.push(item);
{ ... }object syntax instead (i.e.item = { name: "item1", desc: "this is... }. If you're going to create the objects this way, you'll also want to callitems.push(item);after each object literal. Otherwise you're never going to have anything in your array asitemhas not been defined at the time of reference.itemsthat contains theitemobjects. If you wantitemsto be an object and eachitemto be an object, you'll need to determine what the names of the three subobjects will be.