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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.