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.
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.
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
精彩评论