Why can't I figure out how to generate a "h" and a "C" in JavaScript without string literals or function calls?
It is possibly impossible.
Why can't I figure out how to generate a "h" and a "C" in JavaScript without string literals or function calls?
It is possibly impossible.
@noelle The primary technique is generating values and then converting them to a string that I then index into to get a letter.
"c" is generated with ([]+{})[!![]-[]+((!![]+!![])+[])]
([]+{}) results in string concatenation between an empty array and an object, which gives me "[object Object]".
Then that string is indexed into with "12" generated by !![]-[]+((!![]+!![])+[])
!![]-[] => true - "" => 1 - 0
!![]+!![] => true+true => 2
2 + [] => 2 + "" => "2"
1+"2" => "12"
@zatnosk I love how obscure this is. How are you getting the other letters?
Unfortunately, I'm also missing "w" and "P", which would let me write "getOwnPropertyNames", which in turn would let me pull out "getCharCode" without touching "C" or "h".
If I could generate "h" and "C" from non-letter expressions, then I could remove the last three letters from this source code of an expression that evaluates to my name:
https://gist.github.com/Zatnosk/4d80a9e72bec6ec3b73a6d0b1443aea7
@zatnosk what you are doing is a solved problem. All of JS can be written with six characters: []()!+
cc @noelle
Chirp! is a social network. It runs on GNU social, version 2.0.1-beta0, available under the GNU Affero General Public License.
All Chirp! content and data are available under the Creative Commons Attribution 3.0 license.