Monthly Archives: December 2013

Exploring the Huffman Compression Algorithm in JavaScript

The JavaScript program below displays a simple message, encodes that message using a Huffman tree, displays the tree and the message encoded as bits, then decodes those bits using the same tree and displays the result, to verify that it … Continue reading

Posted in Uncategorized | Tagged , , , | Leave a comment

Using IndexedDB to Persist Client-Side Data in JavaScript

The code below demonstrates a few features of IndexedDB, allowing the user to create, retrieve, update, and delete instances of the “Widget” object from the browser’s local persistent object store. To see it in action, copy the code into an … Continue reading

Posted in Uncategorized | Tagged , , , , | Leave a comment

Simulating a Spiral Galaxy Using JavaScript

The code below generates a random simulated galaxy of stars, and displays both a top view and a side view of that galaxy. The structure could probably use some tweaking, which is especially apparent from the side view. But it’s … Continue reading

Posted in Uncategorized | Tagged , , , | 3 Comments