What is JavaScript

Hi there. I hope everyone of you reading this is enjoying their lives at the best of it.

So we have been so far learning what are the tools of the trade specially for web-development. By now we know about HTML, DHTML and XHTML. Though we haven’t yet used those, but be with me and I’ll help you out to learn all these with as much ease as possible.

So as we have seen so far with HTML that all it do is present data to you in the form of a web page and that’s all. What if you want to add some interactivity in your pages, want to change the color of some text when user clicks it or increase the size of text when user clicks it, show some drop down menus, changing the background color of your web page after every 10 seconds, display a different ad on your page, every time the user comes on your page and a lot more stuff like this.

You can’t do any of this with just using HTML. So what can you do? You need some programming language to do all this for you. But when it comes to programming language, there are two problems regarding web-development. One to run a code written in a programming language, you need some special software and second with a programming language, developers with bad intentions can write web pages that would end up stealing information from user’s systems that they are displayed on or do harm to their systems.

So what was required an intermediate solution, a language that doesn’t require some special software to be installed to run the code and second that doesn’t give so many options to the developers to do any harm.

The result was a language called “LiveScript” by Netscape. Netscape was the company behind the very popular browser of its time, Netscape navigator. So LiveScript was the scripting language that helped developers to add interactivity to their web-pages. All it needed was a browser to run on and obviously everyone who viewed a web-page, viewed it in a web-browser. So problem solved, no special software was required. Later on due to the popularity of Java Programming Language, LiveScript was renamed as what we know of it today as “JavaScript”. Microsoft later introduced their own scripting language as “VBScript”. Though with time, JavaScript has become the one scripting language used in web pages today.

I know, already by now, a lot of questions must be simmering in your mind. So lets begin.

In the beginning I said something about the need of a programming language and the I started saying we’ve got a Scripting Language. So what’s the difference.

A code written in programming language is converted into compiled form(machine code) before it executes. A code written in scripting language stay as it is and a special software reads it every time and runs it accordingly (web browser in case of JavaScript).

So what do we use for JavaScript for these days.
We do add interactivity to our web-pages using JavaScript. When a form is submitted, before sending it back to the server, there are certain thing that need to be done to make sure that the right data is sent to the server. For example before sending the data, first of all you need to make sure that the data is there to be sent; the user did fill out every required field, the data entered in the form was in correct format like in case of email address. User selected to buy two items from your site, the unit price was already displayed on the page, all the user need would be the total price calculated and displayed.

So JavaScript is a Client-Side Scripting Language that is used to do client-side validations, client side calculations and create dynamic effects on client-side like drop down menus, floating boxes, changing colors, displaying random images and so much more like this.

1 comment: