Are the alert
and confirm
functions built in to JavaScript, or are they part of the DOM?
Bonus points if you can refer me to a reference that will allow me to easily tell what functions are directly built in to JavaScript.
One useful function that's native to JavaScript is the alert() function. This function will display text in a dialog box that pops up on the screen.
JavaScript Message Boxes: alert(), confirm(), prompt() JavaScript provides built-in global functions to display messages to users for different purposes, e.g., displaying a simple message or displaying a message and take the user's confirmation or displaying a popup to take the user's input value.
The alert() is a method of the window object.
The JavaScript alert() function is a function available on the global window object. It commands the browser to display a modal dialog with a message and an "OK" button.
These functions are usually only available in a browser environment, but they are not part of any standard , this is referred to as DOM level 0.
https://developer.mozilla.org/en/DOM/window.alert
To get a better idea of what the difference is between javascript and the DOM, read this article https://developer.mozilla.org/en/JavaScript_technologies_overview
They are part of what is commonly referred to as DOM level 0 which isn't part of any standard.
MDN has a good JavaScript reference. It doesn't include objects that aren't part of core JS (although other sections on the site do cover DOM and other APIs).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With