Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Arrays, loops or objects for days of a month in an event calendar using JS?

If I want to create an event calendar in JS, which allows the user to click each month day printed out, what would be the best approach to generate each day cell considering the fact that when the calendar is (re)loaded each event added by user is loaded to the respective day and month? Ex.: if the user has event for this day, print in the day cell for this day.

1 Answer

Steven Parker
Steven Parker
231,169 Points

It sounds like you need some sort of form to submit new events to the server, and server code to store them into a database. Then the page would be dynamically constructed by the server when requested, using the database to populate the appropriate days with information.

So most of this job will probably be server-side, do you use JS on the server? Otherwise this work might be done in whatever is normally used on the server.

Great! Very helpful. Tnx Steven :)