The alert() method

The alert() method pops up a message to the viewer and the viewer has to click OK to continue.

window.alert("Hi and welcome!");

It can be shortened as the following:

alert("Hi and welcome!");

This kind of shortcut will work for almost all the window properties and methods. However, you shouldn’t use this shortcut with new windows and location property.

Leave a Reply