Sorry, you are boring me.
What I said was
"But alerts are considered to be obsolete. In practice you should use DOM methods to display a message to your user."
Any sensible person would interpret that as referring to document.getElementById() and innerHTML.
I have never heard anyone claim that alert() was a DOM method. But you may be right - on a geeky and pedantic level. Why are you seeking to start a pointless argument? How can your intervention be of the slightest use to the OP?
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.