It does... in any control, you can specify any/all included javascripts you want to use.
When that control gets rendered, it will automagically include (and dynamically load, if needed) the javascript that you want to have.
See line 4 of something like QDialogBox.class.php:
protected $strJavaScripts = '_core/control_dialog.js';
When the dialogbox gets rendered for the first time on the page, it will ensure that control_dialog.js is loaded onto the page.
Note that the path is relative to the JS_ASSETS directory as defined in your configuration.inc.php file.