# Error Expression Expected

**URL:** <https://forum.ionicframework.com/t/error-expression-expected/179416>\
**Category:** Ionic Framework\
**Created:** [December 10, 2019, 3:19pm UTC](https://forum.ionicframework.com/t/error-expression-expected/179416 "2019-12-10T15:19:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![acuity07](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/acuity07/32/129674_2.png) [@acuity07](https://forum.ionicframework.com/u/acuity07)\
**Post date:** [December 10, 2019, 3:19pm UTC](https://forum.ionicframework.com/t/error-expression-expected/179416/1 "2019-12-10T15:19:36Z")

</div>

export class HomePage implements OnInit {

subscribe: any;

constructor(public Platform: Platform, ) {  
this.subscribe = this.Platform.backButton.subscribeWithPriority(666666, ()

```
  => {

  if (this.constructor.name == "HomePage") {

    if (window.confirm ("Do you wanna exit the app?")) {

      navigator["app"].exitApp(),

   } //this is giving error on exit app

  }

});

```

}

ngOnInit() {  
}

}

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [December 10, 2019, 8:28pm UTC](https://forum.ionicframework.com/t/error-expression-expected/179416/2 "2019-12-10T20:28:45Z")

</div>

Never write code that relies on the string value of classes or methods. It will break in production.

---

<div class="post-metadata">

**Author:** ![acuity07](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/acuity07/32/129674_2.png) [@acuity07](https://forum.ionicframework.com/u/acuity07)\
**Post date:** [December 18, 2019, 6:16pm UTC](https://forum.ionicframework.com/t/error-expression-expected/179416/3 "2019-12-18T18:16:24Z")

</div>

may you show me how i can substitute that one

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [December 18, 2019, 7:04pm UTC](https://forum.ionicframework.com/t/error-expression-expected/179416/4 "2019-12-18T19:04:59Z")

</div>

I would use the strategy outlined in [this similar topic](https://forum.ionicframework.com/t/close-the-app-by-hardware-back-button-on-ionic-4/179738).
