jbmanz Posted March 17, 2015 Share Posted March 17, 2015 I want to be able to use the current date to solve a math problem, specifically as follows:If today is March 17, the math problem of the day should be:(Month times Day of Month) + 99 = Answer of the Day(3 x 17) + 99 = 150How can I create a java script to find the current month and the current day of month, multiple those two together, then add 99 and display the answer as a result. Ideally I'd like to embed this into an existing simple html page by referencing the JavaScript "math problem" so when "index.html" is opened, I have a line that shows immediately: "The answer of the day is: X" (or 150 today, etc). Thank you -- JB Link to comment Share on other sites More sharing options...
justsomeguy Posted March 17, 2015 Share Posted March 17, 2015 Use the Date object. Scroll down and review the various instance methods.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now