Utilize filter to retrieve an array instead of an object, then select the first element
let val = this.administrationList.filter(pItem => pItem.partnerid == 7)[0].partnername;
If you prefer to receive the object directly, use the find method
let val = this.administrationList.find(pItem => pItem.partnerid == 7).partnername;
Another option is to employ the reduce function
let val=this.administrationList.reduce(function(prev, curr) { return (curr.partnerid === 3) ? curr.partnername : prev; }, null);
var administrationList = [
{
"runid": 6,
"partnerid": 2,
"partnername": "test admin2",
},
{
"runid": 5,
"partnerid": 5,
"partnername": "test admin1"
}
]
let val = administrationList.filter(pItem => pItem.partnerid == 7)[0]
console.log(val ? val.partnername : null) ;
val = administrationList.find(pItem => pItem.partnerid == 2);
console.log(val ? val.partnername : null)
val=administrationList.reduce(function(prev, curr) { return (curr.partnerid === 5) ? curr.partnername : prev; }, null);
console.log(val)