JavaScript Dialogs
JavaScript dialog boxes provide an easy way to receive inputs from visitors and output results for them to see. We can use these functions to make all sorts of things!!

JavaScript dialog boxes provide an easy way to receive inputs from visitors and output results for them to see. We can use these functions to make all sorts of things!!
Before we begin…
I highly recommend following along in this article! It’ll help you understand and remember the concepts better. To get started, create this HTML file and then open it up in your browser:
<html> <head> <title>JavaScript Dialogstitle> head> <body> <script> // Exciting code coming soon! script> body> html>
If you want to try out some JavaScript, you can put it in thetag, save, reload the page and see what happens!
You’re all set up now! Enjoy…
Alert
Let’s say we want our JavaScript to output something. We have a few options…
1. console.log
it
This method is great for testing our program, but it’s not a good way to output something in the final product. This is because no-one can see what you’re outputting unless they open up the console!
2. Put the result into our HTML
Using the JavaScript DOM, we can put the result in our HTML. This is good because it displays the result to a visitor without them having to open the console. Note that alerts are much easier than this method — if you’re in the very early stages of learning JavaScript, maybe stick to alerts for now.
3. Use alert
!
Alerts are little boxes that pop up over a web page with some text. Here’s what it looks like in Google Chrome:
Cool, right? Now the visitors have a little box that pops up saying whatever we tell it to say in our JavaScript!!
Apa Reaksimu?






