Summary of Problem
I'm still learning Javascript and I know this may be basic but I'm having some trouble.
I have a object containing nested objects and I need to check if any of the nested objects have a property that matches a specific value.
Code
I want to check the object below to see if const eSportsUsername = "Dark" exists and return a Boolean.
Const object = {
Dark: {_id: "5da78b305f0cc7fc44417821", online: false, eSportsUsername: "Dark"},
HighDistortion: {_id: "5da78b505f0cc7fc44417825", online: false, eSportsUsername: "HighDistortion"}
}
Can anyone recommend how to achieve this?
obj.hasOwnProperty('a')if exist only you need to check if online is true