What's the difference between window.alert() function and the alert () function in javascript.? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the difference between window.alert() function and the alert () function in javascript.?

Javascript

16th Dec 2017, 4:16 PM
Damilola Daramola
Damilola Daramola - avatar
4 Answers
+ 3
None. alert, among many other functions are from the window object, but browsers allow you to call it without referencing the window object.
16th Dec 2017, 4:19 PM
voidneo
+ 1
Got that.. Thanks much... That means there are other windows objects...
16th Dec 2017, 4:25 PM
Damilola Daramola
Damilola Daramola - avatar
0
It is basically the same function. Difference is that in window.alert() call, it is called using the object whereas in alert(), it is explicitly called.
16th Dec 2017, 4:44 PM
Suhail P Salim
Suhail P Salim - avatar
0
Not really, theres always only one window object, but it changes depending on the browser
16th Dec 2017, 4:55 PM
voidneo