-1

This is the original code and i want to join to sections.

const sections = 
[
                                            
    {
        title: section1_title,
            rows: [{ title: section1_option01, rowId: "sec1_option01", description: section1_option01_description }]
    
    }

]

How i can do that

const sections1 = 
[
                                            
    {
        title: section1_title,
            rows: [{ title: section1_option01, rowId: "sec1_option01", description: section1_option01_description }]
    
    }

]
const sections2 = 
[
                                            
    {
        title: section2_title,
            rows: [{ title: section2_option01, rowId: "sec2_option01", description: section2_option01_description }]
    
    }

]

and finally

const joinsection = sections1 + sections2 (Something like this)

I tried to combine the two in this way but without success.

Cole
  • 23
  • 8

1 Answers1

3

You can use the spread operator Spread syntax

const joinsection = [...sections1, ...sections2];