خرید بک لینک

Vote count: 0

Why doesn't the 'values' array contain the 'Title' of each item within 'results'?

The following code outputs: 1, 2, 3, 3, 3, 3 rather than the desired: 1, 2, 3, 1, 2, 3.

var results = [
  {Title: '1'},
  {Title: '2'},
  {Title: '3'},
];
var fields = {
    Title: { Name:"Title", Required:true},
    Description: { Name:"Description", Required:false}
};
var values = [];
results.map(function(result, i){
    values[i] = fields;
    Object.keys(result).map(function(key, index) {
        values[i][key].Value = result[key];
    });
    console.log(values[i].Title.Value);
});
values.map(function(value){console.log(value.Title.Value)});
asked 30 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 4 ارديبهشت 1396 ساعت: 19:36

صفحه بندی