Click here to Skip to main content
15,891,679 members

Comments by Vivek Sharma 3 (Top 1 by date)

Vivek Sharma 3 21-Jan-23 5:28am View    
here I have nested arrrays and objects not sure where it will end ? How can I write logic for that if a objects is having {},{[]},[],[{}]

datasets.map((data) => {
Object.keys(data).map((header) => {
//console.log(header)
data[header].map((headerData) => {
if(Array.isArray(data[header])) {
//console.log(headerData)
} else {
console.log(headerData)
}
})
})
})

this code should be dynamic not sure how i can make it dynamic so that it can handle all the nesting scenarios ?