Huffman in js