How do you iterate thru an array that is a property value? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do you iterate thru an array that is a property value?

Need help with this algorithim https://code.sololearn.com/WuvgMnbd50kx/?ref=app

9th Jun 2019, 2:07 AM
Mario
Mario - avatar
1 Answer
+ 1
Try var contains = hobbies[property1].includes(hobby); Please note that iterating using in keyword would get the keys of the object, not the properties. let key in object. If you want to access object properties from iteration all objects, use for (let property1 of Object.values(hobbies))
9th Jun 2019, 2:22 AM
Calviղ
Calviղ - avatar