Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are the alert and confirm functions built into JavaScript, or are they part of the DOM?

Tags:

javascript

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.

like image 650
Vivian River Avatar asked Apr 15 '12 21:04

Vivian River


People also ask

Is alert part of 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.

Is alert a built-in function?

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.

Which object has alert method in JavaScript?

The alert() is a method of the window object.

What does alert do in JavaScript?

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.


2 Answers

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

like image 61
Willem D'Haeseleer Avatar answered Sep 17 '22 23:09

Willem D'Haeseleer


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).

like image 38
Quentin Avatar answered Sep 20 '22 23:09

Quentin