0

I want to get the index of arrays that are present inside a nested array. I have written the below script but I am not getting the index of the array.

What am I missing?

const Data = [
     
      ["item 1", "item 1.1", "item 1.2", [543, 8329]],
      ["item 2", "item 2.2", "item 2.3", [3980, 56]],
      ["item 3", "item 3.3", "item 3.4", [64, 435]],
    
      
    ];
    
    const flist = [
         ["item 2", "item 2.2", "item 2.3", [3980, 56]],
         ["item 3", "item 3.3", "item 3.4", [64, 435]],
        ]
        
    let fl = [0, 2];

    flist.map((data) => {
       fl.push(Data.indexOf(data));
     });

    console.log(fl);

getting [0, 2, -1, -1]

geek glance
  • 111
  • 2
  • 9

0 Answers0