Ionic sidemenu issue

I have a sidemenu fron JSON data,
but i need some menu as static.

private initializeOptions(): void {

  
    for(let i =0; i < this.sidemenus.length; ++i) {
      this.myArray.push({'displayName': this.sidemenus[i].category,"subItems":[]});
      for (let j=0; j < this.sidemenus[i].subs.length; ++j) {
        this.myArray[i].subItems.push({'displayName': this.sidemenus[i].subs[j].subcategory,'component': 'MainshopPage'});
      }
    }
    console.log('myArray',this.myArray);
    alert(JSON.stringify(this.myArray))
    this.options = this.myArray;
    // this.options = new Array<MenuOptionModel>();

  }

i tried this


  private initializeOptions(): void {

    this.myArray.push({
      displayName: 'Home',
      component: HomePage,
    });  
    for(let i =0; i < this.sidemenus.length; ++i) {
      this.myArray.push({'displayName': this.sidemenus[i].category,"subItems":[]});
      for (let j=0; j < this.sidemenus[i].subs.length; ++j) {
        this.myArray[i].subItems.push({'displayName': this.sidemenus[i].subs[j].subcategory,'component': 'MainshopPage'});
      }
    }
    console.log('myArray',this.myArray);
    alert(JSON.stringify(this.myArray))
    this.options = this.myArray;
    // this.options = new Array<MenuOptionModel>();

  }

but it shows error
erro

@addwebsolution please help

Initialize your Array before pushing.
myArray:any[]=[]

I already initialized
myArray:any=[];

Hi, @Faizyfaazz
try this :

this.myArray.push({displayName:'Home',component:'Page2Page'});
       for(let i =0; i < this.sidemenus.length; ++i) {
            let data = [];
             for (let j=0; j < this.sidemenus[i].subs.length; ++j) {
                data.push({displayName: this.sidemenus[i].subs[j].subcategory,component: 'MainshopPage'});
             }
             this.myArray.push({displayName: this.sidemenus[i].category,subItems:data});
       }

       console.log('myArray',this.myArray);

if your issue was resole please mark as a solution.