The alert() function is used to create a popup box that will send the end user a warning, or strong message.
alert(message)
message
Optional. This is a plain-text string to display in the popup box. It can be pure plain-text, or a combination of pure plain-text and text derived from the content of JS variables.
When used in your code, the alert() function presents a message or warning to the end user. The end user will have to click on the OK button for the rest of you JS code to continue executing. If the end user chooses to close the popup box by clicking on the red X in the upper right corner, rather than clicking on the OK button, any remaining JS code will execute as if the OK button was pushed.