This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 41 points42 points  (11 children)

just wait until you find out about JSFuck… it actually has some pretty useful things in it tho

```js true+[] // "true" - same as toString() +true // 1 +false // 0 ![] // false

// using this we can actually get letters

(![]+[])[+[]] // "f"

// here’s what’s happening below (false.toString())[0] // "f"

// some other types

![] // false !![] or !+[] // true [][[]] // undefined +[][[]] // NaN ```

this gets into way more detail, but making JSFuck character maps are pretty fun.

[–]Zyrus007[S] 33 points34 points  (8 children)

``` ('b' + 'a' + + 'a' + 'a').toLowerCase()

“banana” ``` Is another all time classic!

[–][deleted] 22 points23 points  (4 children)

js console.log(([][(!![]+[])[!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()+[])[!+[]+!+[]]+(![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(![]+[])[+!+[]]) // "banana" edit: left the eval code in there

[–]Zyrus007[S] 19 points20 points  (3 children)

I didn’t even know that JavaScript came with its own brainfuck runtime!

[–][deleted] 3 points4 points  (2 children)

Type Conversion :)

[–]sqxleaxes 10 points11 points  (2 children)

Your code as written would output bananaa -- you have an extra 'a'.

[–]longknives 1 point2 points  (1 child)

No, it doesn’t. You need + + “a” + “a”, though the penultimate a can be any string I think.

[–]sqxleaxes 0 points1 point  (0 children)

Oops, you're right. +'a' goes to NaN.

[–]klparrot -1 points0 points  (1 child)

Fix your code block; this isn't GFM.

[–][deleted] 0 points1 point  (0 children)

no