|
-
Jan 31st, 2005, 05:15 AM
#1
Thread Starter
Fanatic Member
"? and :"
Hi,
The following function is a good one to indicate "random movements to all directions"
What I am really after is more examples of the usage of"question mark" and "the semicolon"
as in the example below..Could you please add some comments to the following lines
what for do we use "?" and ":" Or is there any javascript tutorials that describe ":" and "?"
Thanks
function randomdir() {
if (Math.floor(Math.random()*2)) {
(Math.floor(Math.random()*2)) ? xdir='--': xdir='++';} else {
(Math.floor(Math.random()*2)) ? ydir='--': ydir='++';}id2 = setTimeout('randomdir()', 20000);
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|