TheFilmGod Posted June 27, 2009 Share Posted June 27, 2009 // Add contents to month array for (var cal_num = 0; cal_num <= 12; cal_num++) { month[cal_num] = month_name[cal_num]; } What's wrong with this? Quote Link to comment Share on other sites More sharing options...
corbin Posted June 27, 2009 Share Posted June 27, 2009 Did you declare month before the loop? Also, why are you doing that? Why not just do: month = month_name; ? Quote Link to comment Share on other sites More sharing options...
xenophobia Posted June 28, 2009 Share Posted June 28, 2009 That will loop 13 times. Are you sure? Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted June 28, 2009 Author Share Posted June 28, 2009 Good point about the 13 times. Its a calendar so it should only loop 12 times. Yes, I declared the variable beforehand. I'm just playing around w/ the code. I'll completely revamp it tomorrow morning. It's getting really late. Thanks guys! Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted June 28, 2009 Share Posted June 28, 2009 Why not do something like this - var month = new Array('January', 'February', ...); month[0] = 'January' It's essentially the same thing you're doing there except your method is redundant. Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted June 28, 2009 Author Share Posted June 28, 2009 although the code excerpt makes it seem like I'm being redundant, the month array will be an extremely long string. The month name is the first portion of the string. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.