How do I define and handle alerts?

How do I define and handle alerts?

Please check the tutorial video about alert handling from this link.