My array contains NewColumn_1, NewColumn_2, NewColumn_3 etc... I am getting Max NewColumn_ Value in Array. Here NewColumn_SomeValue generating dynamically.
var products = [{
"ProductID": 1,
"ProductName": "Chai",
NewColumn_1:'abc'
NewColumn_2:'abc',
NewColumn_3:'abc',
NewColumn_4:'abc'
},{
"ProductID": 2,
"ProductName": "Chang",
NewColumn_1:'def',
NewColumn_2:'abc',
NewColumn_3:'abc',
NewColumn_4:'abc'
}]
var fieldValue = "NewColumn_" + (maxValueInArray);
products[i].NewColumn = jsonData[i].Title;
I need to products[i].fieldValue =jsonData[i].Title;
i am unable to do. can any one help this.
products[i].NewColumn, it should be column 1,2,3.... likeproducts[i].NewColumn_1maxin this context? Max value from all object fields (it will be quite strange to compare strings)? Or max index ofNewColumn_X(which is alwaysNewColumn_4)?