I have this array "Group":
i would like to have the value of name (test01) but i have undefined with console.log(group['name']), console.log(group[name]) or console.log(group.name).
How i can display the value ?
Thanks
I have this array "Group":
i would like to have the value of name (test01) but i have undefined with console.log(group['name']), console.log(group[name]) or console.log(group.name).
How i can display the value ?
Thanks
It's an array of objects - access the specific object first using group[0]
then access the property you want with group[0].name
.
const group = [{ name: "test01" }];
const res = group[0].name;
console.log(res);
Based on what you have you can call your propriety if it's an object or an array of objects.
const object = {
name: "test1",
group: "c2"
}
console.log(object.name)
const array = [{
name: "test1",
group: "c2"
}]
console.log(array[0].name)