I have the code below that finds the item details in array which works well.
var findGroupId = medias.find(medias => medias.group_name === this.groupName)
My medias is an array variable. Then the result of console.log(findGroupId)
is below:
But when I do console.log(findGroupId.group_id)
the result is undefined
. But when I try changing the demo here under Using ES2015 arrow function and do demo on JavaScript Demo: Array.find(), it works well.
Am I missing something?
Sample array output (fetched from database):
PS: trying not to use for loop to save some memory and time.