Monday, February 25, 2013

Java script online editors/web playground

Today I’m going to share information regarding tools which I use for test my Javascript/HTML/CSS  functionality.

jsfiddle(http://jsfiddle.net)


This is very useful web playground which can be used to simulate/test our javascript function .


jsbin(jsbin.com)

This is also  web playground which can be used to simulate/test our javascript function .

Thursday, February 21, 2013

Why should we learn advanced Java Script?

Although, JavaScript introduces as web scripting language in 1995 by Brendan Eich (employee of Netscape), JavaScript is not only a web scripting language further; it can be used as server side programming language (node.js), Client Application development language (windows 8)

Some Characterizes of Javascript

Prototype-based-( not as Object Oriented Language)
Dynamic (can be drop property in any time in the cycle)
Weekly Type -(every type variable declare as var and function can receive any type variable)


JavaScript Basic

Declaring array:

var myArray= []

Creating empty Object:

var myStudentObject={};
var myStudentObject=new Object();
var myStudentObject=Object.create(null);

Initialization object

myStudentObject.name=”Dinesh”;
or
var myStudentObject= {name:”Dinesh”}

Functions

How to declared function

function firstFunction (){
}
or
var secondFunction=function(){
}

arguments –Key word

We can pass any arguments to function without declare and we can use arguments key word which inherit for every function to retrieve those arguments.

Ex:
function addNumber (){
var answer=arguments[0]+ arguments[1];
return answer;
}
Then we can call it as
firstFunction(1,2);

Method

var Operation={
add: function addNumber (){
var answer=arguments[0]+ arguments[1];
return answer;
}
};

//call it
var x= Operation.add(2,3)

Immediate Function

These function execute immediately .
(function(){
}())
Or
(function(){})();

Passing parameters to immediate  function
(function(a,b){
}(1,2))


DOM Selector

var a=documents.getElementsById(“pic”);//
 var q=documents.quarySelector(“h2”);//get first element
var list=documents.quarySelectorAll(“h2”);//get all elements