Javascript Fun !

 
Javascript Fun !

Write javascript using symbols only, like (_ $ [ ] { } + -).
But the code length will be huge for small script.

eg : The following code will make the alert(1);

Code:

_=""|"",__=!_+_,___=__+__,_$=__+___,_$_=_$+__,$=![]+"",$$=!""+"",$$$=[{}]+"",$_=[][""]+"",$_$={_:$$$[_$_+__]+$$$[__]+$_[__]+$[_$]+$$[_]+$$[__]+$_[_]+$$$[_$_+__]+$$[_]+$$$[__]+$$[__],_$:$[__]+$[___]+$[_$_]+$$[__]+$$[_],__:$[_]+$_[_$_+__]+$[___]+$$[_]+$[_$_]+$$[__],$_:$$[__]+$[_$_]+$$[_]+$_[_]+$$[__]+$_[__],$__:$[_$]+$[_$_]+$[___]+$[_]},$_$.$=[][$_$.__][$_$._]($_$.$_+" "+$_$.$__)(),$_$.$[$_$._$](__)

How To:

in javascript we can make alert in many way like

alert(1);
window["alert"](1);
this["alert"](1);

we can’t directly execute alert using symbols, we need window object or need to eval,
so i prepare the window object using following.

[]["filter"]["constructor"]("return self")()["alert"](1)

in this i can pass all value as string, so i prepare symbols for each chars.
eg:-

""|""        // make 0
!_+_         // make 1
![]+""       // make "false" string

// if i need char a i use like this ("false")[1] = "a"

$=![]+""
$[!_+_]      // make char a.

Another method is available, but it make more complicated to understand.
But in that only 6 symbols used. []!+()

Make Fun?

Reference : http://www.jsfuck.com/

Suresh Pandi
Latest posts by Suresh Pandi (see all)