I have the following array with 4 Objects:
var btnObj = [
{sect_title: 'Navigation', btn_title: 'Übersicht'},
{sect_title: 'Navigation', btn_title: 'Inhaltsverzeichnis'},
{sect_title: 'Modul 1', btn_title: 'Lehrwerk'},
{sect_title: 'Modul 1', btn_title: 'Prinzipien'},
]
The 2 distinct section-titles shall each have their 2 btn-titles inside them resulting in:
var btnObjResult = [
"Navigation" = [
{btn_title: 'Übersicht'},
{btn_title: 'Inhaltsverzeichnis'},
],
"Modul 1" = [
{btn_title: 'Lehrwerk'},
{btn_title: 'Prinzipien'},
]
]
I just cant get my head around how to accomplish this in JS. Thanks a lot for any hint.