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 .
var myArray= []
var myStudentObject={}; var myStudentObject=new Object(); var myStudentObject=Object.create(null);
myStudentObject.name=”Dinesh”; or var myStudentObject= {name:”Dinesh”}
function firstFunction (){ } or var secondFunction=function(){ }
function addNumber (){ var answer=arguments[0]+ arguments[1]; return answer; }Then we can call it as
firstFunction(1,2);
var Operation={ add: function addNumber (){ var answer=arguments[0]+ arguments[1]; return answer; } }; //call it var x= Operation.add(2,3)
(function(){ }()) Or (function(){})(); Passing parameters to immediate function (function(a,b){ }(1,2))
var a=documents.getElementsById(“pic”);// var q=documents.quarySelector(“h2”);//get first element var list=documents.quarySelectorAll(“h2”);//get all elements