If you're making a game for a computer, the node webkit object has a "quit" or "exit" action. Same goes for all the other platforms: They have a similar object for them that can have an "exit" action.
I want to make an android games. How do I make an exit script??
Develop games in your browser. Powerful, performant & highly capable.
use Webbrowser for this