既可以记录日志又显示弹出警报的Javascript功能? [英] Javascript function to both log and show pop-up alerts?
本文介绍了既可以记录日志又显示弹出警报的Javascript功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
全部
有人向我显示了此功能来记录警报:
I was shown this function to log alerts:
function alert(msg) {
console.log(msg);
}
我如何修改它以同时记录警报和并显示通常的弹出窗口?
How would I modify it to both log the alerts and show the usual pop up?
(我想这样做的原因是,我想测试弹出窗口对延迟JS脚本执行的影响-因此,我将在有无弹出窗口的情况下运行脚本两次,并比较日志.)
(The reason I want to do that is that I want to test the effect the pop-ups have on delaying the execution of my JS script - so I will run the script twice, with and without pop ups, and compare the logs.)
推荐答案
使用其他名称:
function shout(msg) {
alert(msg);
console.log(msg);
}
这篇关于既可以记录日志又显示弹出警报的Javascript功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文