I have Json data like below;
let data = [
{
"name": "John Doe",
"position": "Accountant",
"social": ["facebook", "instagram", "youtube", "pinterest"]
},
{
"name": "Michael Schumaher",
"position": "F1 Pilot",
"social": ["facebook", "instagram", "youtube", "pinterest"]
}
];
I need to loop iterate nodes and child arrays called social.
let html = '';
let i;
for ( i = 0; i < data.length; i++) {
let socArr = data[i].social;
socArr.forEach ( function ( item ) {
console.log( item + '/');
});
};
I need to display 'name position social' in the same div, but forEach loop gives me all array data in the json document.
socArr[1]