Let Us Learn JavaScript ( ALERT MESSAGES IN JS #1 )

in Project HOPE2 months ago (edited)

Hello everyone , I was absent from the platform for quite a long time but here I am back with some new things.

I have come today with a Javascript tutorial that will teach a small portion of Javascript to the people. Javascript can be used in ML , AI ,Blockchain Development , and what not.

So follow along and I ll be covering all the basics in future as well so stay tunes and for now just follow along the post.

images_20201006191028493.jpg

I will demonstrate that how simple it is to Generate a Alert Message.
We will also Discuss real life use of the Alert Messages in the post at the end.

Requirements to follow along this post

If you are familiar with basics of html you can continue to read this this tutorial.

So You can use any editor for example VsCode , Brackets , Sublime text or even a simple text editor pre installed into your computer.
I will upload the image below so you can see if you have done any mistakes in your code.
So just perform the following steps :

  1. Create a proper html structure i/e html , head , body , meta tags.
  2. At the end of the body tag create a script tag , for doing so just write script enclosed in <> , just like you define any other tag for example head or body tag in html.
  3. Inside the script tag write the following code :
    window.alert("Welcome to Blurt.world");
  4. Thats it you are done , now when you will save and run you file with any of the browsers you will see an alert message popping up automatically.

Screenshot from 2020-10-04 15-53-09.png

What is window.alert amd why is it used in web development...?

window.alert() is a predefined function in javascript that is used to display a dialog box with some message written in it. The string written inside the double brackets and quotation mark( ("hello") ) is displayed on the window with a OK button to close the dialog box.

You can use this in many places for example if you have created a form where user enters his details and submit it. you can show the alert message of , "Invalid Data Provided" if the details enter by the user is not correct.

You can also simply use alert("your message here") instead of window.alert("your message here") and it will just work fine.

Now i suggest you try creating multiple alert messages one after the another and see what happens.

Output in the browser


you can see the output below for your code.

Screenshot from 2020-10-04 16-12-56.png

That's it for this post , feel free to ask any question regarding the post.
Thank You...!

Sort:  

Hello, I think it's very cool that you upload this type of tutorials, they are very educational, short and really teach what you need and want to know. I thank you very much for sharing this information, it is very good and complete, I will be aware of these great publications.

Most times I want to learn programming but the too much complex of it always discourage me

hello every body.

I am from Venezuela.

I would like to learn java.

Any good place to visit for me.

thanks a lot for your help

#programming

#steemit

#projecthope

#venezuela

what are you planning to do after learning java?

Loading...