Browse Source

Merge pull request #24 from hazzik/optimize-object-literal

Optimize object literal
Martin Kleppe 11 years ago
parent
commit
284fa6c506
2 changed files with 13 additions and 13 deletions
  1. 5 5
      jsfuck.js
  2. 8 8
      output.txt

+ 5 - 5
jsfuck.js

@@ -25,7 +25,7 @@
 
   var MAPPING = {
     'a':   '(false+"")[1]',
-    'b':   '(+(11))["toString"](20)',
+    'b':   '(Function("return{}")()+"")[2]',
     'c':   '([]["filter"]+"")[3]',
     'd':   '(undefined+"")[2]',
     'e':   '(true+"")[3]',
@@ -33,7 +33,7 @@
     'g':   '(+false+[false]+String)[20]',
     'h':   '(+(101))["toString"](21)[1]',
     'i':   '([false]+undefined)[10]',
-    'j':   '(+(40))["toString"](21)[1]',
+    'j':   '(Function("return{}")()+"")[10]',
     'k':   '(+(20))["toString"](21)',
     'l':   '(false+"")[2]',
     'm':   '(Number+"")[11]',
@@ -101,15 +101,15 @@
     '>':   '("")["italics"]()[2]',
     '?':   '(RegExp()+"")[2]',
     '@':   USE_CHAR_CODE,
-    '[':   '(GLOBAL+"")[0]',
+    '[':   '(Function("return{}")()+"")[0]',
     '\\':  USE_CHAR_CODE,
-    ']':   '(GLOBAL+"")["slice"]((+(.+[0000000001])+"")[2]+1)',
+    ']':   '(Function("return{}")()+"")["slice"]("-1")',
     '^':   USE_CHAR_CODE,
     '_':   USE_CHAR_CODE,
     '`':   USE_CHAR_CODE,
     '{':   '(NaN+[]["filter"])[21]',
     '|':   USE_CHAR_CODE,
-    '}':   '([]["filter"]+"")["slice"]((+(.+[0000000001])+"")[2]+1)',
+    '}':   '([]["filter"]+"")["slice"]("-1")',
     '~':   USE_CHAR_CODE
   };
 

+ 8 - 8
output.txt

@@ -25,7 +25,7 @@
 `8` 44
 `9` 49
 `:` 2286
-`;` 8307
+`;` 8205
 `<` 292
 `=` 687
 `>` 298
@@ -41,11 +41,11 @@
 `H` 6608
 `I` 70
 `J` 7301
-`K` 8312
+`K` 8210
 `L` 6708
 `M` 4980
 `N` 16
-`O` 7329
+`O` 1654
 `P` 6577
 `Q` 6579
 `R` 2283
@@ -57,14 +57,14 @@
 `X` 6613
 `Y` 6618
 `Z` 6584
-`[` 2931
+`[` 1640
 `\` 6713
-`]` 6591
+`]` 2043
 `^` 6594
 `_` 6582
 ``` 6582
 `a` 15
-`b` 1748
+`b` 1646
 `c` 144
 `d` 22
 `e` 25
@@ -72,7 +72,7 @@
 `g` 741
 `h` 1763
 `i` 27
-`j` 1769
+`j` 1648
 `k` 1752
 `l` 19
 `m` 729
@@ -91,4 +91,4 @@
 `z` 1807
 `{` 151
 `|` 6723
-`}` 6601
+`}` 536