You are working in a browser environment and must use vanilla JavaScript only (no external libraries).
Implement a function showPopupAndRedirect(message, targetUrl) that does the following:
message
.
targetUrl
.
alert
,
confirm
, or a custom DOM-based modal that you implement yourself).
window.location
or a similar mechanism).
targetUrl
is not a non-empty string, the function should
not
attempt to redirect.
You do not need to handle errors beyond the simple validation of targetUrl described above.
Describe the implementation and then provide the JavaScript code for showPopupAndRedirect.