posted 10 years ago
Section
Subsection
Subsection
Subsection
Section
Subsection
Section
Subsection
Subsection
Subsection
Subsection
Subsection
Subsection
Section
Subsection
Subsection
Subsection
Subsection
Subsection
Section
Subsection
Subsection
Subsection
Subsection
Above is my array and I needed to create an array depending upon the number of occurrence of section.
Eg:-
[
{
"sectionId",
"subSections": [
{
"subSectionId"
},
{
"subSectionId"
},
{
"subSectionId"
}
]
},
{
"sectionId"
"subSections": [
{
"subSectionId"
}
]
},
{
"sectionId"
"subSections": [
{
"subSectionId"
},
{
"subSectionId"
},
{
"subSectionId"
},
{
"subSectionId"
},
{
"subSectionId"
},
{
"subSectionId"
}
]
}
];
Can anyone please provide me sudo- code for this? I am using JavaScript.
Basically I want 5 Arrays of sections and its size will be depending upon the subsections