views:

39

answers:

2

Dear experts,

I was analyzing Javascript codes and came across this line:

var date = (new Date()).getDate();

This kinda throw me off?

I am pretty new to Javascript and a little curious.

+1  A: 

It creates a date object that is based on the exact time that the object was created.

Then getDate() gets the day of the month of the Date object. This value is stored into a variable for use.

Kevin Crowell
A: 

As a beginner, you'll find lots of value in the documentation. w3schools.com has a good, usable organization:

http://www.w3schools.com/jsref/jsref_getDate.asp

Cheeso