-4

I am working on a javascript program and i'll need to merge the below multidimensional array into one array

array = [
    [ '78161701,20221101,20221108' ]
    [ '76450406,20221101,20221108' ]
    [ '76450047,20221101,20221108' ]
    [ '76450111,20221101,20221108' ]
    [ '72606489,20221101,20221108' ]
    [ '79557102,20221101,20221108' ]
]

This is my expected outcome

array = [
    '78161701,20221101,20221108',
    '76450406,20221101,20221108',
    '76450047,20221101,20221108',
    '76450111,20221101,20221108',
    '72606489,20221101,20221108',
    '79557102,20221101,20221108'
 ]
Salim
  • 1
  • 2
  • 2
    Please add the code you've tried – adiga Nov 11 '22 at 15:39
  • 1
    Your “expected outcome” is invalid. Does your original array really have single-element arrays inside? – Sebastian Simon Nov 11 '22 at 15:41
  • array = [ '78161701,20221101,20221108', '76450406,20221101,20221108', '76450047,20221101,20221108', '76450111,20221101,20221108', '72606489,20221101,20221108', '79557102,20221101,20221108' ] This is actually the expected outcome – Salim Nov 11 '22 at 15:46
  • Please clarify if you want your outcome to contain quote marks or not. – Andrew Parks Nov 11 '22 at 15:54
  • It should contain quote marks – Salim Nov 11 '22 at 15:56
  • When you are asking help from volunteers, posting compilable input, output and the code you've tried is the absolute bare minimum. The input is missing commas. Why did the output suddenly change? – adiga Nov 11 '22 at 15:57

1 Answers1

0

const array = [
    [ '78161701,20221101,20221108' ],
    [ '76450406,20221101,20221108' ],
    [ '76450047,20221101,20221108' ],
    [ '76450111,20221101,20221108' ],
    [ '72606489,20221101,20221108' ],
    [ '79557102,20221101,20221108' ]
];
console.log(array.flat());
Andrew Parks
  • 6,358
  • 2
  • 12
  • 27