From Esolang
Jump to: navigation, search

BestFriends.js is a two-dimensional esoteric programming language invented in 2006 by David Millar with the goal of creating an esoteric javascript library.

A BestFriends.js script is very similar to Brainfuck. It has almost exactly the same commands, except for the addition of a few new ones.


The code is written in your JavaScript like this: BF(command string,input string);

Example, creates a popup with the letter 'd' on it:

var c = "+++++[>+++++<-]>}|" +
        "[<++++>-]<.@    {";

BestFriends.js has the following commands:

Command Description
+ Add 1 to current memory cell.
- Subtract 1 from the current memory cell.
> Move the memory pointer to the right.
< Move the memory pointer to the left.
[ Start a loop. You CANNOT use nested loops in BestFriends.
] End of a loop. If current memory cell is 0, continues program, otherwise restarts loop.
{ Turns the program pointer 90 degrees left (anticlockwise).
} Turns the program pointer 90 degrees right (clockwise).
! Clear output string.
: Run eval() on output string.
@ Ends the script and returns the output string.
| Separates rows of commands.
, Puts the first character of the input string in the current memory cell. As of the first version, this command does not work. The problem is being looked at carefully.
. Writes the ascii character of the current memory cell to the output string.
Anything else is a comment.

Related languages

External resources