Introduction to Javascript


This article covers the introduction of javascript scripting language, javascript is a client side scripting language which is now a standard of HTML5 scripting laguage.

JavaScript is a Well Known scripting language, for the client side interpreted programming. It was first created for the Netscape to give the users flexibility to program some features at browser. Now with HTML5 the JavaScript has been accepted as a standard. There are so many frameworks of JavaScript out three now. The best is J Query which is more popular than even JavaScript itself. Lets Dive little into the history of JavaScript before we move on to discuss its features.

History

JavaScript was born at Netscape where it was named Live Script but later it was renamed to JavaScript because its some libraries and structure are similar to Java Programming Language. But one shall not assume it as a subset of Java. It is completely different programming language. After its birth and renaming, it was adopted by Microsoft too in its IE3. Later on with the increasing popularity newer version of browsers started to support it.

Despite of several security issues of arising in the past JavaScript become a great client side script it provided so much flexibility. The biggest Issue was its capability of DOM manipulation which may cause several problems and it was also used for the script injection. Later on these issues were discussed but even after several improvement they persist. However JavaScript only became more and more popular even after all these issues.

JavaScript is now a trademark of Oracle. It was accepted a standard as ECMA 262 specification. There was also an attempt to develop server side JavaScript but it never got the popularity as JavaScript, it was called Server Side JavaScript.

Features

JavaScript is an interpreted language which lists so many features, its really handy and provide so much of programming flexibility. One can do Object based programming as well as structural programming. JavaScript allows you to do so, so here we list some of its most powerful features.

Structural Programming: JavaScript syntax is so much like C and all its structural parts are similar to C except for the scoping of the variables. JavaScript uses the functional scoping.

Dynamic Typing: JavaScript supports the dynamic typing, the focus is on the values, you can store any type of value in any type of variable. The same variable can be used to store integer and same can be changed into the string or object.

Object Orientation: JavaScript support the object based approach. you can create the arrays as well as objects the syntax is quite similar but objects are more flexible.

Run-time evaluation: JavaScript supports the function execution at runtime.

Functional Programming: JavaScript comes with so many inbuilt functions which can be called in at any time and also it allows you to create the custom functions. And the functions in JavaScript are object themselves. You can assign and bind properties with them. The recursion is also supported in JavaScript.

Array and Object literal: JavaScript support the arrays, it can be vector array or multi dimentional arrays. You can create the array literal as well as object literal in JavaScript.

Regular Expression: JavaScript also support Regular Expressions.

General Syntax and hello world in JavaScript

The JavaScript follows the C syntax we assume you are familiar with the C programming language. Here is a simple dummy program which uses the function and displays "Hello World" in a alert box.


//defining function booBar
function fooBar(message){
	alert(message);
} 

//invoking functino fooBar
fooBar("Hello World");

you can write this code of JavaScript in a separate JavaScript file and then include it in your HTML page using script tag.


<scirpt type="text/javascript src="foobar.js">
</script>

or else you can place this code just inside the script tag as inline javascript.

you will see the output as an alert box displaying the Hello World as message. alert() is an inbuilt function of javascript which is used to show the message on the screen.

hello world alert

So here we leave you with the introduction of javascript, We hope you will go further with learning javascript.