JavaScript is scripting programming language used at client side as well as at server. JavaScript does not have any relation with Java programming language. However JavaScript syntax some what similar to Java. JavaScript is not a complied language and partially object oriented means it does not support all the features of object oriented programming language. JavaScript also has features of dynamic language means programmer can change the type of object at runtime.

JavaScript is case sensitive means, following statements will have different meaning

var myObject = 1;
var myobject = 2;

instead of using confusing variable declaration better to follow the standards for naming the variable names.

JavaScript Variable

JavaScript also used variable for storing and processing in memory data. JavaScript variables are not strongly typed. var keyword is used for declaring variable in JavaScript.

var varnumber = 2;


var varstring = "Test";

You can see that we have used the keyword var for declaring an integer value as well as for string value. we can also assign different values to same variable name.

JavaScript Function

JavaScript functions are defined with the keyword Function. Typically functions are created for using the same code over the complete application.  Like other programming languages JavaScript functions also accept parameters and return values. JavaScript Functions can also be placed in a separate JavaScript file.

function demo() {
    alert("Demo function");

JavaScript Prototype

JavaScript prototype is a property that allows programmers to change types at runtime. Once a method or an attribute has been added to the prototype of an object, instances of

this object can access the new member by using the keyword this followed by a dot “.”

and the name of the member.

JavaScript Types

Following types are supported in JavaScript

Number: JavaScript treat all kind of number variables as number, this includes integer,double and short. Number keyword can also be used for declaring numbers .

String: character strings in JavaScript can be defined in two ways using the single quote or double quote. String keyword can also be used for defining string values.

var doublequote="This is a JavaScript string";
var singlequote = 'This is another string';

Boolean: Boolean variables hold the true of false values

var testboll= true;

Date: Date object allows date/time calculations.

Function: JavaScript functions also work as objects means programmers can pass a function from one object to another object.

Object: Objects are user defined types.

Array: Array are special type of objects contains variables and object. Array are accessed through index like in other programming languages.