1👍
You can use this expression:
campaigns.displays.map( ({name}) => name );
const campaigns = { displays: [{ name: 'info1'}, { name: 'info2'}] };
const result = campaigns.displays.map( ({name}) => name );
console.log(result);
0👍
This will display an array containing the property names of each object in the displays
array
var data = {
displays: [
{
capacity: 9000,
id: 1,
imei: 44596
}
]
};
data.displays.forEach(function(obj, idx) {
console.log(Object.keys(obj));
});
Object.keys()
is what you need
- [Vuejs]-Update item in array in Vue didn't update it in html but it updates value in cli
- [Vuejs]-How to modify deep vuex data with v-model
Source:stackexchange.com