Are you familiar with BrainFuck language? No? It's simple.
It's a esoteric programming language that consists only of the following chars:
+
, -
, <
, >
, [
, ]
But we are JavaScript fan boys and girls. We want to crete our own.
We want to create our own awesome esoteric language using only the following valid JS chars:
[
, ]
, (
, )
, !
and +
I bet it's enough to write any program that we like.
Rome wasn't built in 1 day, so do we start small.
Let's write the expression that evaluates into 0
using only those chars.
That wasn't too hard, wasn't it?
Now let's add 1
to our alphabet.
Write an expression that evaluates into 1
.
Now we are all set to actually compose numbers. But we will cheat a little - we will treat them as strings. Your task now is to convert an input string that contains numbers into series of JSFuck chars.
For example:
Input: 345
Output: [!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]
Ok, so we have numbers. It's time to start talking... And for that we need letters. Hmm...
That's going to be challening. Let's start with a
.
Your task is to write expression that evaluates into letter a
.
Tip: remember that string in JS can be treated as arrays.
Having a simple letter, let's compose a word or may be even an operation.
Write an expression that evalutes into alert(0)
.
Since we are able to write a command, can't we execute it?
Write an expression that evaluates/executed the command alert(0)
.