How to exit the app in Javascript ?

in android end() of director seems to work but not in iOS.

What will be the best way exit the app?

you can make a crash to exit app

Besides, you can’t add any exit button in your iOS app, otherwise, Apple will reject your app request in App Store

I think I should hide the button in iOS builds but keep in Android.

Need to put an if condition, if its Android show the exit button (MenuItem actually)

Thanks