Home > front end >  I have muliple arrays of single object with multiple values and i want to get these values and displ
I have muliple arrays of single object with multiple values and i want to get these values and displ

Time:12-31

I,m having an issue in getting object with multiple arrays. How can i get multiple array of single object.

enter image description here

CodePudding user response:

You can use console.table() to your table. You can declare a variable named as cardDatas. Then you can use console.table(cardDatas). Please consider to share the code by enclosing the full code in ``? Then I can provide the output for you.

CodePudding user response:

If the data is consistent, you can create a new array, for loop throw your initial array and push your elements.

Something like this.

const data = [
    {
        cardData: [
            {
                title: "a",
            },
        ],
    },
    {
        cardData: [
            {
                title: "b",
            },
        ],
    },
];

let cardData = [];

for (const elm of data) {
  cardData.push(elm.cardData[0]);
}

console.log(`cardData`, cardData);

  • Related