I have an array from a response in which I need to get the value that is present in the salary attribute of args array of id Proprety attribute from each object/response. How can achieve this?
var arr = [
[
{
id: "alex",
idProperty: {
args: [
{
name: "alex_name"
},
{
salary: "16L"
}
]
}
},
{
id: "john",
idProperty: {
args: [
{
name: "john_name"
},
{
salary: "14L"
}
]
}
}
]
];
EDIT: thanks to every one for all the answers for the above query but how to get the same salary attribute if the structure is :
case 1 :
var arr = {
[
id: "alex",
idProperty: {
args: [
{
name: "alex_name"
},
{
salary: "16L"
}
]
}
],
[
id: "john",
idProperty: {
args: [
{
name: "john_name"
},
{
salary: "14L"
}
]
}
]
};
case - 2
var arr = [
{
id: "alex",
idProperty: {
args: [
{
name: "alex_name"
},
{
salary: "16L"
}
]
}
},
{
id: "john",
idProperty: {
args: [
{
name: "john_name"
},
{
salary: "14L"
}
]
}
}
];
I am sorry to ask if this is so simple as I am really new to react native and java script and so confused with various scenarios.