Javascript "for" syntax -


so in this question asked how javascript compressed. question answered yet following snippet confuses me had ask question. here is:

for (y = 0; $ = 'zxqj`_^zwvuqonmkjihgca@8$  ' [y++];)       with(_.split($)) _ = join(pop()); eval(_)  

where syntax come from? kind of understand third operation ([y++]), why in brackets , why isn't there semicolon before it? also, @ line 2: looks me _ variable being declared, kind of variable type with(_.split($))?

any for command can broken down. start "classic" loop:

for( i=0; i<end; i++) 

this translates to:

  • set i=0
  • repeat following long i<end:
    • run code in block
    • increment i

so, applying same code:

  • set y=0
  • as long character in position y of string exists (ie. y not past length of string), assign character $ , increment y, then:
    • run code in block
    • do nothing (there nothing after second semicolon)

it's ugly hell, still makes sense if break down.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -