alert和window.alert有什么区别? [英] What is the difference between alert and window.alert?

查看:472
本文介绍了alert和window.alert有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

alert() window.alert()函数有什么区别?它似乎工作原理相同。

What is the difference between alert() and window.alert() functions? It seems to work the same.

推荐答案

因为窗口是全局的对象,您可以通过它的简写来调用 alert alert('Hello!'); 或通过引用特别是全局对象: window.alert('Hello!');

Because window is the global object, you can call an alert either by it's shorthand: alert( 'Hello!' ); or by referencing the global object specifically: window.alert( 'Hello!' );

它们是相同的。

这篇关于alert和window.alert有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆