Tag Archives: JavaScript

A Retirement Savings Calculator in JavaScript

The JavaScript program below, when run, allows a user to calculate how many years it will take to save enough to replace their salary based on the specified initial savings, savings per year, and rates of return before and after … Continue reading

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

An Adding Machine in JavaScript

The JavaScript code below implements a simple adding machine. To see it in action, copy it into a .html file and open that file in a web browser that runs JavaScript. Or, for an online version, visit https://thiscouldbebetter.neocities.org/addingmachine.html.

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

A Simulation of Pest Eradication in JavaScript

The JavaScript code below, when run, simulates a ecological pest-eradication scenario. An exterminator chooses a target at random, travels over a network of links and nodes to get as close as possible to the target, moves off the network towards … Continue reading

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

A Simple Data Transcoder in JavaScript

The JavaScript program below converts data encoded in UTF8, Base64, or hexadecimal format into one of the other encodings. To see the code in action, copy it into a .html file and open that file in a text encoder that … Continue reading

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

Exploring the SVG Vector Image File Format in JavaScript

The JavaScript program below accepts a vector-based “path” in JSON format and converts that path to the SVG format. The output can then be viewed in a program that understands the SVG format, such as most modern web browsers. The … Continue reading

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

Drawing Ellipses (Ovals) to an HTML5 Canvas with JavaScript

The JavaScript code below, when run, prompts the user to input information about an ellipse (oval), and then draws that ellipse to the screen. To see it in action, copy it into an .html file and open that file in … Continue reading

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

A Binary To Image File Transcoder In JavaScript

The JavaScript program below, when run, allows the user to load an arbitrary file as bytes, convert it to a PNG image, save the image as a file, reload that image file, convert it back to bytes, and re-save the … Continue reading

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