The code and algorithm is based on the fire example in The Demo Effects Collection, originally in C (source). The algorithm is pretty simple: randomly pixels are turned on/off in the bottom row. Each row is then shifted up, blurred with the next row (from the previous frame), decayed and color mapped.
The flame intensity randomizes by default. You can set it manually using 1…9 on your keyboard (and 0 to go back to random mode). You can also tweak the rendering resolution by resizing the canvas element. The FPS can also be modified by altering the source.