date object
var today = new date(); // return todays date
to make out own obj
we can we
var day= new Date(2011,0,1);// year month and day , month as an exception starts as 0
var daytime= new Date(2011,0,1,0,0,0);//also adds hours , mins and secs with previous
Get methods of date obj
day.getMonth();
day.getYear();
day.getTime();
Set methods
day.setMonth(5);
comparison
var date1= new Date(2001,1,1);
var date2= new Date(2001,1,1);
if(date1==date2)//false
if(date1.getTime()==date2.getTime())
CREATING NEW OBJECT
var player= new object();
now its data members will be declared as
player.name="fred";
player.age=13;
player.rank=1;
A variable inside a object is called its properties, same as data member
shorthand to create an object
var player= {name: "Fred",age:13,rank:1};
var today = new date(); // return todays date
to make out own obj
we can we
var day= new Date(2011,0,1);// year month and day , month as an exception starts as 0
var daytime= new Date(2011,0,1,0,0,0);//also adds hours , mins and secs with previous
Get methods of date obj
day.getMonth();
day.getYear();
day.getTime();
Set methods
day.setMonth(5);
comparison
var date1= new Date(2001,1,1);
var date2= new Date(2001,1,1);
if(date1==date2)//false
if(date1.getTime()==date2.getTime())
CREATING NEW OBJECT
var player= new object();
now its data members will be declared as
player.name="fred";
player.age=13;
player.rank=1;
A variable inside a object is called its properties, same as data member
shorthand to create an object
var player= {name: "Fred",age:13,rank:1};
No comments:
Post a Comment