Analog Clock in JavaScript
Discover how to create an analog clock using HTML, CSS, and vanilla JavaScript, all centered around an object-oriented design.
HTML/CSSJavaScript
Explore how to build a simple, yet fully-functional, arithmetic calculator in vanilla JavaScript.
This project aims at building one of the most fundamental programs for a newbie JavaScript developer — a basic arithmetic calculator to perform basic arithmetic operations like addition, subtraction, multiplication, and division. We try replicating the design of a rudimentary calculator, with buttons on it to execute given functions in addition to a display screen to display the results of given calculations.
Starting off with the most basic thing, i.e. the visual UI design of the calculator, we get to see how exactly to approach building programs in JavaScript, going through such things as wireframing, constructing the HTML skeletal structure, styling with CSS, and so on.
As for the logical part, we take on a procedural approach. The procedural paradigm is mature and quick to develop in, yet one that is often overlooked in favor of OOP. In this project, we aim to explore the real potential of procedural programming by developing a well-designed program in it.
A calculator program might seem simple or boring enough to even try building, but that's not the case with this project. Here, we iteratively challenge ourselves at every stage of building the calculator with new constraints and features. This helps us fuel the most important aspect of programming — thinking.
The calculator begins simple but soon throws numerous technical challenges at us, for e.g. showing a default-zero display, handling erroneous calculations, controlling operators, allowing keyboard inputs, adding thousands separators, and so on and so forth.
By the end of this project, you'll know how to:
try..catch
in JavaScript to handle errors at run time.In this module, we'll learn what exactly is going to be built in the project, and also get the environment all set up for development.
In this module, we'll be designing the calculator's interface, beginning with a quick wireframe, and then ending with writing the HTML and CSS for it.
In this module, we'll create the very first, basic implementation of our calculator, with the help of eval()
.
In this module, we'll set our entire focus on improving the calculator by adding many useful features to it, such as error-handling, thousands separators, prevention of entering octal numbers, and so on.
Let's get building!
Discover how to create an analog clock using HTML, CSS, and vanilla JavaScript, all centered around an object-oriented design.