Your SlideShare is downloading. ×
0
javascript function & closure
javascript function & closure
javascript function & closure
javascript function & closure
javascript function & closure
javascript function & closure
javascript function & closure
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

javascript function & closure

359

Published on

javascript function & closure

javascript function & closure

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
359
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  1. S53#11-1 hashmap1-2 window1-3 function & execution context2012.10.17 20:30 ~ 22:30
  2. text = Javascript result = Parsing Text result = hashmap, hashmap, hashmap, hashmap, hashmap, hashmap, hashmap, hashmap, hashmap, hashmap,.....Bernstein hash hashmap, hashmap, hashmap, hashmap,Fowler-Noll-Vo hash function hashmap, hashmap, hashmap, hashmap,Jenkins hash function hashmap, hashmap, hashmap, hashmap,Pearson hashing hashmap, result hashmap, hashmap, hashmap,Zobrist hashing hashmap, hashmap, hashmap, ...unsigned long hash(unsigned char *str){ unsigned long hash = 5381; int c; while( c = *str++ ) hash = ((hash << 5) + hash) + c; return hash;}
  3. <html> ( function window(){<head> this = window||arguments.callee;<script> var val0, val1;var val0 = test0;key0 = 3; val0 = test0;function a(){} this.key0 = 3;</script> function a(){};<body> val1 = test1; this.key1 = 4;<script> function b(){};var val1 = test1;key1 = 4; } )();function b(){}</script></body></html>
  4. wkey = "key"; Function[test] = {var wVar = "win"; parent: windowEC, locals:{function test( a ){ a:null, var b; b:null b = :test; }, ( function(){ arguments:[a], var c; body:..... c = :c; }; alert( a + b + c ); alert( wKey + wVar ); } )();}test( hello ); testEC = {// hello:test:c a:null, b:null, arguments:{ 0:hello, length:1, callee: Function[test] }, this: window, __parent__:Function[test].parent, test: Function[test] }; for( i = 0 ; i < testEC.arguments.length ; i++ ) testEC[Function[test].arguments[i]] = testEC.arguments[i];
  5. wkey = "key"; testEC.b = :test;var wVar = "win"; Function[@35] = { parent: testEC,function test( a ){ locals:{c:null}, var b; arguments:[], b = :test; body:..... ( function(){ }; var c; c = :c; alert( a + b + c ); @35EC = { alert( wKey + wVar ); c:null, } )(); arguments:{} length:0, callee:Function[@35]test( hello ); },// hello:test:c this: window, __parent__:Function[@35].parent, test: Function[@35] }; for( var i = 0 ; i < @35EC.arguments.length ; i++ ) testEC[Function[@35].arguments[i]] = testEC.arguments[i];
  6. wkey = "key"; @35EC.c = :c;var wVar = "win"; temp = @35EC.__parent__.a +function test( a ){ @35EC.__parent__.b + var b; @35EC.c; b = :test; alert( temp ); ( function(){ temp = this.wKey + var c; @35EC.__parent__. __parent__.wVar; c = :c; alert( temp ); alert( a + b + c ); alert( wKey + wVar ); delete @35EC; } )();} delete testEC;test( hello );// hello:test:c
  7. function getValue( $ec, $key ){ var result, temp; temp = $ec; while( ( result = temp[$key] ) === undefined ) if( (temp = temp.__parent__ ) === null ) break; if( temp !== null ) return result; temp = $ec.this; while( ( result = temp[$key] ) === undefined ) if( (temp = temp.__prototype__ ) === null ) break; if( temp !== null ) return result; throw new error();}temp = @35EC.__parent__.a + temp = this.wKey + @35EC.__parent__.b + @35EC.__parent__. __parent__.wVar; @35EC.c; alert( temp );alert( temp );temp = getVal( @35EC, a ) + temp = getVal( @35EC, wKey) + getVal( @35EC, b ) + getVal( @35EC, wVar); getVal( @35EC, c ); alert( temp );alert( temp );

×