More efficient way to do this? (photo)

@gemats depending on how far you want to go with this, I’d suggest to work with an intermediate object which contains the data to populate your UI components.

You can either choose to manually add the data to the object in your application layer, but getting it from the database is also an option.

var nbItems = 29; //get from db
var cb = {
 "label": "",
 "description": ""
}

var obj = [];
for(i=0;i<nbItems;i++){
 cb.label = db[i].label;
 cb.description = db[i].description;
 obj.push(cb);
}
console.log(obj);

//populate UI elements