What is the difference between alert and window.alert?

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!' );

They are the same.

Leave a Comment