The alert() method is one of JavaScript's most useful functions. This function displays text in a pop-up dialogue box on the screen. We must first call the showAlert() function before we can use this function. In response to events, JavaScript functions are invoked.