Tag Archives: JavaScript

A Word-for-Word Inline Translation Utility in JavaScript

The JavaScript program below, when run, prompts the user for a passage to be translated into a foreign language and a dictionary that provides translations, then presents the translated text interleaved with the original text. The translation is word-for-word, which … Continue reading

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

Exploring the PNG Image File Format with a PNG Viewer in JavaScript

The JavaScript program below, when run, prompts the user to upload a PNG file and displays that image. To see the code in action, copy it into an .html file and open that file in a web browser that runs … Continue reading

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

Decompressing Data with the DEFLATE Algorithm in JavaScript

The code below, when run, prompts the user to upload a compressed file in GZIP format, which will then be uncompressed, and the uncompressed data will be displayed both as hexadecimal digits and as UTF8 text. This implementation of DEFLATE … Continue reading

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

Rendering to Texture with WebGL

The JavaScript program below, when run, will display a simple three-dimensional scene rendered with WebGL. It is nearly identical to a program from a previous post, except that this version demonstrates how to render a scene to a texture, rather … Continue reading

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

Finding Collisions of Circles and Line Segments in Javascript

The JavaScript program below creates a field full of circles and line segments of random size, position, and velocity, and calculates and displays the collisions between them. To see the code in action, copy it into an .html file and … Continue reading

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

Finding Collisions of Circles in JavaScript

The JavaScript program below creates a field full of circles of random size, position, and velocity, and calculates and displays the collisions between them. To see the code in action, open it in a web browser that runs JavaScript.

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

A JSON Serializer with Referential Integrity

Below is a JSON serializer implemented in JavaScript, along with an automated test of that serializer. When run, the program creates a complex test object, serializes it to a string in JSON format, deserializes that string back to an object, … Continue reading

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