I have an object like this:
{
username: {
hobby: [
{
hobby1: "cricket",
hobby2: "swim"
},
{
hobby3: "dance",
hobby4: "zumba"
}
]
}
}
I can easily do a forEach
and do console.log(item)
but what if I just want the values cricket,swim,dance,zumba alone (don’t need hobby1
through hobby4
). Can someone show me how to extract the values alone?