OZONE Asylum
Forums
DHTML/Javascript
20 Liners - July 08 - Your favorite video game
This page's ID:
30391
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Don't worry no one will bite your head off if you make a 25 liner. Except maybe zombies. We only count the lines of "effective" code. This eliminate [i]function declarations[/i] and [i]element.onFoo[/i]. What count as one "effective" line is basically anything else that constitue one JavaScript expression ( it can contain several statements of course ). Tho get an idea:[code]// WARNING: nonsensical example approaching // declare a couple of variables /* 01 */ var baz = "Fy", /* | */ foo = /* | */ { /* | */ name:"Bob", /* | */ kind:"cat", /* | */ yield:function( msg ) /* . */ // the expressions of this function count /* */ { /* 02 */ var msg = msg||"I'm "+ name +" the "+ kind +"."; /* 03 */ alert( "Meow! "+ msg ); /* */ } /* . */ // resume to line 01 /* | */ isAlive:Math.random()>.5; /* | */ }, /* | */ bar = "it's candy"; /* */ document.body.onclick = function() /* */ { /* 04 */ val= prompt( 'enter a number' ); /* 04 */ for( i=0; i<10; i++ ) /* */ { /* 05 */ alert( stupidFunction( val, i ) ); /* */ } /* */ } // like regular function, anonymous function declaration do not count /* */ (function() /* */ { /* 06 */ setTimeout( arguments.callee, 10 ); /* */ }) /* 07 */ (); // calling it, however counts as an expression /* */ function stupidFunction( a, b ) /* */ { /* 08 */ return a>b?a:b; // I said it was a stupid function /* */ } [/code]But again, JavaScript's syntax is loose and we're doing this for fun so don't worry. Have fun. [url=http://www.p01.org/][img]http://poi.ribbon.free.fr/files/p01_ozoneasylum_sig_dk.gif[/img][/url] [small](Edited by [url=http://www.ozoneasylum.com/user/2185]poi[/url] on 07-18-2008 10:09)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »