November 2019
Beginner
804 pages
20h 1m
English
This method will be a simple utility that displays messages to the end user. For simplicity, we will only use a basic alert box. In later projects, we will use so-called toast notifications instead, as it'll look better and will also provide a better user experience.
The following is the implementation:
displayErrorMessage(errorMessage: string): void {
if (!errorMessage) {
throw new Error("An error message must be provided!");
}
alert(errorMessage); // bad for user experience but ignore this for now
}
Read now
Unlock full access