/    Sign up×
Community /Pin to ProfileBookmark

Cycle Through Variables with Dates Please Help!

Hi, I am a complete noob to JavaScript and the following problem has been drivin g me nuts all day. Basically I have a list of variables, they all have a date set inside them, and hour via setFullYear, and setHours.
OK now how do i order these from say 1 to 10, and have it cycle through an IF Else Statement and check if the date is past a certain date, then go onto variable 2, check again and go onto variable 3 until it finds a match.

An Array would be ideal i guess but i don’t know how to create an array with dates inside them? Is this possible?
Or does anybody know how I can cycle through my variables without an array in the form of i++ say.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@SyCoApr 21.2008 — This should cover most of what you need to know.

http://www.pageresource.com/jscript/jarray.htm

Just replace the alert(quote[x]); line with your if conditional statement.
×

Success!

Help @scriptet spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...