You’ve probably seen these used in various places in your ServiceNow instance.
To show a loading dialog…
var loadingDialog = new GlideDialogWindow("dialog_loading", true);
loadingDialog.setTitle('Loading...'); //Set the loading dialog title here...
To hide that same loading dialog…
Another great example is a customization I created to deal with long-loading forms. The customization required that a loading dialog be displayed before the form loaded, and that the loading dialog be destroyed when everything on the form finished.