I'm using Moltin API, what i need is take the category id from the current product.
what could be simple like this:
product.category.id
but, what i get is....
product.category.data.1353881339752874661.id
how can i take this object property dynamically?
below is a print from my browser console:
Yo can do that by iterating the Keys of product.category.data
object.
for (var key in product.category.data){
// use key to refer to each key of the Object.
}
Another option could be, getting the different ids using the Objet.keys()
method.