JavaScript - How It Works and How to Create an Alert Message with JavaScript - Just a test blog
That's all folks!


JavaScript is a very simple and delicate language. It is sometimes called a "Client-Side Scripting Language" because it runs on your browser and process all the data on your computer instead of doing it on the server like PHP.

It has been around from a while now. More than 3 Billion devices run JavaScript and supports JavaScript programs. It's fairly easy to write JavaScript codes but you should first be familiar with how it works.

How JavaScript Works:

When you open a Webpage which has JavaScript on it and it is set do a certain JavaScript task as soon as the page loads, what happens is that the written JavaScript code is first fetched by the browser and then processed very quickly in under a milisecond and the output is send to the screen. Your browser is the interpreter and acts accordingly.

How to Create an Alert Message with JavaScript:

Here's an example of a very basic JavaScript coding, the following code is going to generate an alert saying Get Funky.

Remember, JavaScript codes are written between <script> tags or in a separate .js file which is connected to the main html file.

<script type="text/javascript">
alert("Get Funky");
</script>

What's happening above is a simple alert command is being run which is causing the browser to display the message "Get Funky" (without quotes, quotes are part of the language).

Try the above code in this Online HTML Editor. Notice as soon as you are gonna post the code it'll give you an alert.

It's as simple as that to create those annoying alerts, that's why you see too many of those online.

SHARE ON:

FACEBOOK TWITTER GOOGLE+