Ionic array declaration facing issue

export class HomePage {

constructor(public navCtrl: NavController,private storage: Storage, private sqlite: SQLite) {}
function1(){
this.item = [];
}
}

this code getting below error.

Kindly do this.

export class HomePage {
item:any; //define your item here;

constructor(public navCtrl: NavController,private storage: Storage, private sqlite: SQLite) {}
function1(){
this.item = [];
}
}

1 Like

thank you so much for your answer it works :slight_smile: :slight_smile: :slight_smile:

Two things I would do differently:

  • use a proper type instead of any
  • initialize the array at declaration time, instead of in the constructor