Hi i am new to programming and i want to access the array inside an object using javascript...
i have the datastructure like below,
const some_obj = {
accessKey: "",
children: [
div.someclassname,
div.someclassname,
div.someclassname.highlight,
]
}
Below is what it looks like in browser console when i log the variable.
object
current: div.wrapper
accessKey: ""
align: ""
childElementCount: 4
childNodes: NodeList(4) [div.someclassname, div.someclassname.highlight,
div.someclassname]
children: HTMLCollection(4) [div.someclassname,
div.someclassname.highlight, div.someclassname]
printing some_obj.children in the console gives below output. object.children HTMLCollection(3) 0: div.someclassname 1: div.someclassname.highlight 2: div.someclassname
Now from the some_obj i want to check if some_obj has div.classname.highlight in children array. how can i do it.
i tried using some_obj.current.children.find() but says find is not a function.
how can i check if the some_obj children has the div.someclassname.highlight. could someone help me fix this.thanks