Javascript function to register and display pop-up warnings?

All,

I was shown this function to register alerts:

function alert(msg) {
  console.log(msg);
}

How do I change it to both the alert log and displays a normal pop-ups?

(The reason I want to do this is because I want to check the effect of pop-ups on the latency of my JS script, so I will run the script twice, with and without pop-ups, and compare the logs.)

0
source share
2 answers

Call it something else:

function shout(msg) {
  alert(msg);
  console.log(msg);
}
+1
source
function _alert(msg)
{
 alert(msg);
 console.log(msg);
}
+1
source

All Articles